Skip to content

Search code

POST /api/v1/workspaces/{workspace_id}/code-search/stream

Search indexed public GitHub code and receive matching file previews as server-sent events. The workspace must belong to the key’s account. A workspace identifies the owning search context; it does not turn the query into a private-repository search.

Terminal window
curl --fail-with-body --no-buffer \
"https://githoundexplore.com/api/v1/workspaces/$WORKSPACE_ID/code-search/stream" \
-H "Authorization: Bearer $GITHOUND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"query":"example.com"}'
FieldTypeRequiredRules
workspace_idUUID path parameterYesAn owned workspace ID from List workspaces.
queryJSON stringYes1–2,048 characters after trimming leading and trailing whitespace.

The JSON object accepts only query. Matching uses literal mode. Do not send regex, source, limit, repository filters, or extra fields. Regex syntax is not interpreted as a pattern by this endpoint.

The complete encoded request body must be no larger than 4,096 bytes, with a known Content-Length. A query within the character limit can still exceed the byte limit after UTF-8 encoding or JSON escaping.

200 OK · text/event-stream

The response includes X-Search-API-Version: 1. Each event contains an event name and a JSON data payload, separated from the next event by a blank line.

event: progress
data: {"elapsed_ms":1000}

Expect start, zero or more hit and progress events, then a terminal done or error. Read Stream events for the complete payload reference. HTTP 200 only means the stream opened; it does not establish successful completion.

Each search returns at most 100 hits, runs for up to 45 seconds of search runtime, and is bounded by 1 MiB of public event output. Individual event frames are limited to 64 KiB. A service or connection failure can end the stream earlier.

Searches through the UI and every API key share the account’s daily allowance. Pro currently includes 1,000 searches per day, resetting at 00:00 UTC. API starts are limited to 10 per minute per account, with one active API search per account. Shared service capacity can also reject a request.

Pre-stream failures are refunded according to server admission handling. After streaming begins, completed searches, partial searches, client disconnects, and stream failures remain charged. Retrying is a new search and can incur a new charge; there is no idempotency key or resume cursor.

Close the HTTP response to stop your request. There is no separate cancel endpoint. If the connection closes before a terminal event, mark the received results incomplete and retain them for inspection. Avoid immediately starting many replacements: cleanup and shared capacity recovery can take time.

For 429, honor Retry-After. For transient 503 or an incomplete stream, retry with bounded exponential backoff and jitter only if your workflow needs a new search. For a valid search with zero hits, no retry is required.