{"openapi":"3.1.0","info":{"title":"x402 Code Search API","version":"2.0.0","description":"Pay-per-call semantic code search over an indexed repo.","x-guidance":"POST /index (free) to index a repo, then POST /search (paid) with { repoId, query } for top-5 semantic matches. You are charged only when the search returns matches — an unindexed repoId returns 404 and costs nothing.","x-payment-policy":"NEVER CHARGED FOR AN UNDELIVERABLE ANSWER. The x402 middleware cancels settlement for any response >= 400, so every error below moves $0.00 and emits no payment-response header. An empty result set is returned as 404 repo_not_indexed, never as a billed 200."},"paths":{"/search":{"post":{"operationId":"codeSearch","summary":"Semantic code search","tags":["Dev Tools"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["repoId","query"],"properties":{"repoId":{"type":"string"},"query":{"type":"string"}}}}}},"responses":{"200":{"description":"Top-5 nearest-neighbour matches. The only response you are charged for."},"400":{"description":"NOT CHARGED. `invalid request` — malformed JSON body or missing/blank repoId or query; see `details`."},"402":{"description":"Payment Required"},"404":{"description":"NOT CHARGED. `repo_not_indexed` — no indexed content exists for this repoId, so there is nothing to search. POST /index (free) first. `retryable:false`.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["repo_not_indexed"]},"message":{"type":"string"},"charged":{"type":"boolean","enum":[false]},"retryable":{"type":"boolean","enum":[false]},"repoId":{"type":"string"},"query":{"type":"string"}}}}}},"405":{"description":"NOT CHARGED. Wrong HTTP verb for this resource; see the Allow header."},"502":{"description":"NOT CHARGED. `embedding_upstream_failed` (the embedding model did not answer) or `vector_store_unavailable` (the vector index could not be queried). Both `retryable:true`."}}}}}}