# 2s.io GitHub Code Search

> 2s.io GitHub Code Search is a paid API for AI agents from 2s.io, paid per call via x402, $0.0025/call, status unknown (last checked 2026-09-14).

Search GitHub repositories using GitHub's code-search syntax and return matching file names, paths, repositories, and URLs

## Facts

- Endpoint: GET https://2s.io/api/github/search-code
- Price: $0.0025/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-io-github-code-search-6cf6950f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_elpyqDn_Nz0MafyxmE8xH

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 2s-io-github-code-search-6cf6950f
```

Example prompt: Search GitHub for all JavaScript files that use the addEventListener function — show me the file names, paths, and repo links for the first 10 results.

## When to prefer this

Use this endpoint when you need to search across all public GitHub code using GitHub's powerful code-search syntax (e.g. scoping by repo, language, filename, or path), without needing a GitHub API key. Ideal for agents that need to find real code examples, discover usage patterns of a library or function, or locate specific files across open-source repositories. Prefer this over raw GitHub API calls when no auth token is available and the cost of $0.001 per call is acceptable.

## Known failure modes

- Empty query string returns validation error (minLength:1 violated)
- Query exceeding 400 characters rejected (maxLength:400 violated)
- Invalid page or perPage values return schema validation errors
- Overly broad queries may return very high match counts with limited per-page results
- GitHub's code search index may not include very recently pushed code
- Rate limits from the underlying GitHub API may cause transient failures

## How this service works

Search code across GitHub with the code-search syntax (e.g. 'defineEndpoint repo:AlleyFord/2s' or 'addEventListener language:js'). Returns total match count + file name, path, repository, and URL for each hit. Read-only; no caller key needed.

## Output

Returns the total number of matching files found on GitHub, plus a list of results each containing the file name, file path, repository name, and direct URL to the file on GitHub.

## 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": {
     "const": "http"
    },
    "method": {
     "const": "GET"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "q"
     ],
     "properties": {
      "q": {
       "type": "string",
       "maxLength": 400,
       "minLength": 1
      },
      "page": {
       "type": "integer",
       "minimum": 1
      },
      "perPage": {
       "type": "integer",
       "maximum": 50,
       "minimum": 1
      }
     },
     "additionalProperties": false
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-io-github-code-search-6cf6950f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
