# s2ar Semantic Code Search

> s2ar Semantic Code Search is a paid API for AI agents from api.s2ar.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-10).

Searches a GitHub/GitLab/Codeberg repository by meaning/natural language query and returns matching symbol definitions with file paths and line numbers

## Facts

- Endpoint: GET https://api.s2ar.dev/x402/v1/sym/where?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/s2ar-semantic-code-search-36dd249b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_FV8UaYmH9wIGVZt2x4wxA

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability s2ar-semantic-code-search-36dd249b
```

Example prompt: Search the torvalds/linux GitHub repo for code that handles memory allocation — give me the top 5 matching definitions with their file paths and line numbers.

## When to prefer this

Choose this endpoint when you need to find code by what it does conceptually rather than by exact symbol name. It's ideal for navigating unfamiliar codebases, understanding where specific business logic lives, or finding all code related to a feature without knowing exact function names. Prefer it over the name-based symbol search when you don't know exact identifiers, and over the file skeleton endpoint when you need semantically relevant hits rather than a full structural map.

## Known failure modes

- Repository not found or is private — returns error indicating inaccessible repo
- Query too vague or no semantic matches found — returns empty result set
- Invalid repo format (not owner/repo or valid URL) — returns validation error
- Specified ref/branch/tag does not exist in the repository — returns ref not found error
- Repository too large or indexing timeout — may return partial results or timeout error

## How this service works

Code search by meaning in a GitHub repo — the definitions matching a question, with file and lines. GET ?repo=&query=

## Output

Returns a ranked list of symbol definitions from the repository that semantically match the query, each entry including the symbol name, file path, start and end line numbers, and the matched code snippet or signature.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "queryParams"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "repo",
      "query"
     ],
     "properties": {
      "k": {
       "type": "string",
       "description": "hits to return (default 8)"
      },
      "ref": {
       "type": "string",
       "description": "branch, tag or commit; the default branch when omitted"
      },
      "repo": {
       "type": "string",
       "description": "a public GitHub, GitLab or Codeberg repository: owner/repo, github.com/owner/repo or its https URL"
      },
      "query": {
       "type": "string"
      }
     },
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/s2ar-semantic-code-search-36dd249b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.s2ar.dev](https://www.zero.xyz/host/api.s2ar.dev/llms.txt)
