> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spidra.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit a Search

> Run a real search query and get back structured results — web, news, images, and videos

## How It Works

Search runs asynchronously, same pattern as scrape and crawl: submit a query, get a `jobId` back immediately, then poll `GET /search/{jobId}` until `status` is `completed`.

1. **Submit** - Send your query, receive a `jobId` right away
2. **Resolve** - Spidra fetches real results, automatically retrying against alternate providers behind the scenes if one is temporarily blocked
3. **Poll** - Check `GET /search/{jobId}` until `status: "completed"`

<Note>
  Automated requests to any web search provider can be intermittently blocked. Rather than surfacing that as a failure, Spidra retries automatically until it gets real results back — you don't need to build retry logic yourself, and which provider ultimately answered is an internal implementation detail, not something you need to think about or configure.
</Note>

***

## Sources

By default a search only returns `web` results. Request additional sources with the `sources` array:

```json theme={null}
{
  "query": "best espresso machine 2026",
  "sources": ["web", "news", "images"]
}
```

| Source   | Description                    |
| -------- | ------------------------------ |
| `web`    | Standard web results (default) |
| `news`   | News articles                  |
| `images` | Image results                  |
| `videos` | Video results                  |

<Note>
  If a non-web source is temporarily unavailable, that source comes back as an empty array rather than failing the whole request.
</Note>

***

## Geo-Targeting

Pass `country` to localize results to a specific region — a 2-letter country code, or `global`, `eu`, `asia`:

```json theme={null}
{
  "query": "top restaurants",
  "country": "fr"
}
```

***

## Result Limit

Control how many results come back per source (1-20, default 10):

```json theme={null}
{
  "query": "electric cars",
  "sources": ["web", "images"],
  "limit": 20
}
```

***

<CardGroup cols={2}>
  <Card title="Check Job Status" icon="magnifying-glass" href="/api-reference/search/search-status">
    Poll for results
  </Card>

  <Card title="View Logs" icon="list" href="/api-reference/logs/search-logs">
    See your search history
  </Card>
</CardGroup>


## OpenAPI

````yaml POST /search
openapi: 3.1.0
info:
  title: Spidra API
  version: 1.0.0
  description: >-
    Public API endpoints for web scraping via Spidra. Authenticate with
    `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://api.spidra.io/api
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /search:
    post:
      tags:
        - Search
      summary: Submit a Search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  description: The search query
                  maxLength: 2000
                sources:
                  type: array
                  items:
                    type: string
                    enum:
                      - web
                      - news
                      - images
                      - videos
                  default:
                    - web
                  description: Which result types to fetch
                limit:
                  type: integer
                  minimum: 1
                  maximum: 20
                  default: 10
                  description: Results per source
                country:
                  type: string
                  description: 2-letter country code, or 'global', 'eu', 'asia'
            examples:
              simple:
                summary: Simple web search
                value:
                  query: best espresso machine 2026
              multi_source:
                summary: Multiple sources
                value:
                  query: electric cars
                  sources:
                    - web
                    - news
                    - images
                  limit: 5
              geo_targeted:
                summary: Geo-targeted search
                value:
                  query: top restaurants
                  country: fr
      responses:
        '202':
          description: Job successfully queued
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - queued
                  jobId:
                    type: string
                    description: Unique job identifier for polling
                  message:
                    type: string
                  deduplicated:
                    type: boolean
                    description: >-
                      True if an identical request was made within the last 5
                      seconds and this returns the existing job ID
              example:
                status: queued
                jobId: 550e8400-e29b-41d4-a716-446655440000
                message: >-
                  Search job has been queued. Poll
                  /api/search/550e8400-e29b-41d4-a716-446655440000 to get the
                  result.
        '403':
          description: Quota exceeded or plan limit reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: You have exceeded your monthly credit limit.
        '422':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: Request validation failed. Fix the errors below and try again.
                errors:
                  - '"query" is required and must be a non-empty string.'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
      required:
        - status
        - message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````