> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 检索符号 - POST /v1/workspaces/:workspace_id/code-repos/:repo_id/search

> 通过 POST /v1/workspaces/:workspace_id/code-repos/:repo_id/search 在仓库内语义检索符号。最小角色 viewer。

在代码仓库内做语义检索，返回与查询最相关的符号。

## 接口

```http theme={null}
POST /v1/workspaces/:workspace_id/code-repos/:repo_id/search
```

## 认证

`Authorization: Bearer <jwt>` 或 `X-API-Key <sk_...>`。最小角色：**viewer**。

## 路径参数

<ParamField path="workspace_id" type="string" required>
  工作空间 id。
</ParamField>

<ParamField path="repo_id" type="string" required>
  仓库 id。
</ParamField>

## 请求体

<ParamField body="query" type="string">
  检索文本（省略时回退到查询参数 `query`）。
</ParamField>

<ParamField body="k" type="integer">
  返回的最相似符号数量。
</ParamField>

## 响应

响应为一个数组，每个元素为符号（字段同[列出符号](/api-reference/memo/code-repos/symbols)）。

## 示例

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://memo.ariacompute.cn/v1/workspaces/ws_01a2b3c4d5e6/code-repos/repo_01a2b3c4d5e6/search \
    -H "Authorization: Bearer <jwt>" \
    -H "Content-Type: application/json" \
    -d '{"query":"register API routes","k":5}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "id": "sym_01a2b3c4d5e6",
      "repo_id": "repo_01a2b3c4d5e6",
      "file_path": "internal/api/api.go",
      "name": "RegisterRoutes",
      "kind": "function",
      "signature": "func RegisterRoutes(r *gin.Engine, s *Services)",
      "content": "func RegisterRoutes(...) { ... }",
      "line_start": 50,
      "line_end": 129
    }
  ]
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.