NeedleSearch

API Documentation

Search content, ask questions and retrieve skill guidance.

Base URL: https://seochat.labs.needle.tools

Authentication

Endpoints marked API token required accept the following header:

Authorization: Bearer YOUR_API_TOKEN

GET /api/documents, GET /api/semantic-search and POST /api/ask accept requests without a token. Keyword search and every skills API request require an API token.

GET /api/searchAPI token required

Find matching messages and documents. Pass a query in q; optionally use source to select a named source.

curl "https://seochat.labs.needle.tools/api/search?q=physics" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Example response

{
  "messages": [{ "id": "message-id", "content": "Matching content", "platformName": "Example source" }],
  "documents": [{ "id": "document-id", "title": "Example document", "content": "Matching content" }]
}

Semantic search

GET /api/semantic-searchNo token required

Search by meaning and receive ranked results with content and source links.

ParameterDescription
qRequired search query.
limitMaximum results: 1-20. Default: 10.
max_charsMaximum content characters per result: 200-10000. Default: 2000.
boostOptional source weights, such as SOURCE_ID:2,OTHER_ID:1.5. Values: 0.1-10.
hydeSet to 0 for direct query matching, such as short names or code identifiers.
curl "https://seochat.labs.needle.tools/api/semantic-search?q=how+to+add+physics&limit=5"

Example response

{
  "query": "how to add physics",
  "results": [{
    "type": "document",
    "score": 0.87,
    "title": "Physics components",
    "source": "Example source",
    "content": "Matching content",
    "url": "https://example.com/physics"
  }],
  "durationMs": 142
}

Ask AI

POST /api/askNo token required

Ask a question about available content. Send JSON with a required question string. The optional messages array provides prior user and assistant messages.

curl -X POST "https://seochat.labs.needle.tools/api/ask" \
  -H "Content-Type: application/json" \
  -d '{"question":"How do I get started?"}'

Example response

{
  "answer": "An answer based on the available content.",
  "sources": [{ "type": "message", "metadata": "Example source", "preview": "Relevant content" }]
}

For a streamed response, add Accept: text/event-stream. Events use sources, token and done types.

Skills

API token required for every skills endpoint. Load a skill's instructions, find relevant references and retrieve their complete content. Use webdev as the skill ID for web development guidance.

EndpointOperation
GET /api/v1/skillsDiscover indexed skills: ID, name, description, and default version. Optional limit (1–100, default 50) and offset. Returns skills and hasMore. Consumer-bound tokens require consumer and app parameters.
GET /api/v1/skills/{id}Load instructions and available reference paths.
GET /api/v1/skills/{id}/files/{path}Load one complete file.
GET /api/v1/skills/{id}/versionsList available versions and their default status.
POST /api/v1/skills/{id}/searchFind references relevant to a query.

Omit version to use the configured default. A named version selects that version; latest follows current guidance. Responses include a revision so clients can check whether content changed between requests.

Consumer and application access

Bind a token to a consumer in API & tokens, then save consumer/application pairs under each skill's Available to section. A pair such as cloud / * allows every app for that consumer. Requests must name a specific app.

GET https://seochat.labs.needle.tools/api/v1/skills?consumer=cloud&app=editor&environment=production
Authorization: Bearer CLOUD_TOKEN

{
  "skills": [{ "id": "animate", "name": "Interface Animation", "description": "Build and refine interface motion.", "defaultVersion": "latest" }],
  "limit": 50,
  "offset": 0,
  "hasMore": false
}

Include these same parameters on load, file, versions and search requests. Missing parameters return 400; a consumer that differs from the token returns 403. Unassigned skills return 404, and a list with no matches returns an empty skills array. Filtering happens before pagination.

Optional environment=production or environment=staging filters availability rules and separates request history. A blank Environment in a rule allows all environments; a named environment requires an exact match. Omitting the request parameter only matches unrestricted rules.

The trusted consumer must validate application identity before forwarding requests. Consumer-bound tokens can only read skills. Existing unbound tokens retain their access without these parameters; they cannot use consumer/app parameters until bound. Authenticated requests, including zero matches, appear in the Skills administration page.

Load instructions

curl "https://seochat.labs.needle.tools/api/v1/skills/webdev" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "id": "webdev",
  "version": "latest",
  "revision": "revision-id",
  "path": "SKILL.md",
  "content": "Complete skill instructions",
  "references": [{ "path": "guides/example.md", "title": "Example guidance" }]
}

Search references

Send query as a required string. Optional fields: version and limit (1-20, default 8).

curl -X POST "https://seochat.labs.needle.tools/api/v1/skills/webdev/search" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"accessible dialog","version":"latest","limit":5}'

Search responses contain results with reference paths, titles and previews. Load a returned path with the file endpoint; optionally pass ?version=latest or a named version.

Errors

Invalid parameters return 400. Missing or invalid credentials return 401 or 403. An unavailable skill, version or file returns 404.

For a plain-text endpoint reference, see /llms.txt.