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

# Submit search

> Run a search across supported web and social sources. The default response returns an operation to poll; add sync=true only when you want to wait briefly for an immediate result.

# POST /api/v1/search

> Submit a search across web, LinkedIn, X, Reddit, or TikTok. Returns 202.

Submit a search query across one or more platforms. Returns `202 Accepted` with a poll URL.

For Reddit post search, set `type` to `reddit_search`. Use `sort_by: "relevance"` for Reddit's relevance ranking or `sort_by: "recent"` for Reddit's newest-post ranking.

## Example

```bash theme={null} theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST https://developer.thehog.ai/api/v1/search \
  -H "X-Access-Key: ak_xxxxxxxxxxxxxxxx" \
  -H "X-Secret-Key: sk_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"type": "web_search", "query": "AI CRM tools", "max_results": 10}'
```


## OpenAPI

````yaml api-reference/openapi.json POST /api/v1/search
openapi: 3.0.0
info:
  title: The Hog API
  description: Public API reference for The Hog.
  version: '1.0'
  contact: {}
servers:
  - url: https://developer.thehog.ai
security: []
tags: []
paths:
  /api/v1/search:
    post:
      tags:
        - Search
      summary: Submit search
      description: >-
        Run a search across supported web and social sources. The default
        response returns an operation to poll; add sync=true only when you want
        to wait briefly for an immediate result.
      operationId: submitSearch
      parameters:
        - name: sync
          required: false
          in: query
          description: >-
            Set to true to wait briefly for a completed result instead of
            immediately returning an operation to poll.
          schema:
            type: boolean
        - name: Idempotency-Key
          in: header
          description: >-
            Prevents duplicate work if you retry the same request with the same
            key.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostSearchDto'
      responses:
        '200':
          description: Search completed immediately.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResultDto'
        '202':
          description: Search accepted. Poll the returned URL for status and results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchAcceptedDto'
        '400':
          description: The request body or parameters are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponseDto'
              example:
                statusCode: 400
                error: Bad Request
                message: Validation failed
                path: /api/v1/search
                timestamp: '2026-05-21T09:08:10.000Z'
                requestId: 506af9b3-01a9-43be-9eb4-8458fe3e4f5b
                errors:
                  - property: body.query
                    message: query must be a string
                    constraints:
                      isString: query must be a string
        '401':
          description: Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponseDto'
              example:
                statusCode: 401
                error: Unauthorized
                message: Authentication is required.
                path: /api/v1/search
                timestamp: '2026-05-21T09:08:10.000Z'
                requestId: 506af9b3-01a9-43be-9eb4-8458fe3e4f5b
        '402':
          description: The organization does not have enough credits for this request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponseDto'
              example:
                statusCode: 402
                error: Payment Required
                message: Insufficient credits.
                path: /api/v1/search
                timestamp: '2026-05-21T09:08:10.000Z'
                requestId: 506af9b3-01a9-43be-9eb4-8458fe3e4f5b
        '422':
          description: The request body is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponseDto'
              example:
                statusCode: 422
                error: Unprocessable Entity
                message: Validation failed
                path: /api/v1/search
                timestamp: '2026-05-21T09:08:10.000Z'
                requestId: 506af9b3-01a9-43be-9eb4-8458fe3e4f5b
                errors:
                  - property: body.query
                    message: query must be a string
                    constraints:
                      isString: query must be a string
        '500':
          description: An unexpected error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponseDto'
              example:
                statusCode: 500
                error: Internal Server Error
                message: An unexpected error occurred.
                path: /api/v1/search
                timestamp: '2026-05-21T09:08:10.000Z'
                requestId: 506af9b3-01a9-43be-9eb4-8458fe3e4f5b
      security:
        - AccessKey: []
          SecretKey: []
components:
  schemas:
    PostSearchDto:
      type: object
      properties:
        type:
          type: string
          description: Type of search to perform
          enum:
            - web_search
            - site_search
            - linkedin_keyword
            - x_keyword
            - reddit_search
            - tiktok_keyword
            - tiktok_hashtag
          example: web_search
        query:
          type: string
          description: >-
            Search query string. Required unless match_any/match_all are
            provided.
          example: AI startup funding 2026
        match_any:
          description: >-
            Keywords where ANY must match (OR logic). Used to build search
            query.
          example:
            - AI startup
            - machine learning funding
          type: array
          items:
            type: string
        match_all:
          description: >-
            Keywords where ALL must match (AND logic). Used to build search
            query.
          example:
            - Series A
            - '2026'
          type: array
          items:
            type: string
        exclude:
          description: Keywords to exclude from results.
          example:
            - crypto
            - blockchain
          type: array
          items:
            type: string
        max_results:
          type: number
          description: Maximum results to return (default 10, max 50)
          default: 10
        site:
          type: string
          description: Domain to restrict search to (required for site_search)
          example: techcrunch.com
        include_domains:
          description: Domains to include results from (web_search only)
          type: array
          items:
            type: string
        exclude_domains:
          description: Domains to exclude results from (web_search only)
          type: array
          items:
            type: string
        sort_by:
          type: string
          description: >-
            Sort by relevance or recency for supported keyword searches. Reddit
            maps recent to Reddit's new sort.
          enum:
            - relevance
            - recent
          default: relevance
        match_mode:
          type: string
          description: >-
            Match mode for LinkedIn keyword searches. exact searches the query
            as a quoted phrase; broad sends the query without phrase quotes.
          enum:
            - exact
            - broad
          default: exact
        date_filter:
          type: string
          description: Date filter for LinkedIn search (e.g. past-24h, past-week)
        hashtag:
          type: string
          description: >-
            Hashtag to search for (required for tiktok_hashtag type, without #
            prefix)
          example: productanalytics
        subreddit:
          type: string
          description: Subreddit to search within (reddit_search only)
          example: startups
      required:
        - type
    SearchResultDto:
      type: object
      properties:
        id:
          type: string
          description: Unique search result ID
        status:
          type: string
          description: Current status
          enum:
            - queued
            - processing
            - succeeded
            - failed
        type:
          type: string
          description: Search type
          enum:
            - web_search
            - site_search
            - linkedin_keyword
            - x_keyword
            - reddit_search
            - tiktok_keyword
            - tiktok_hashtag
        query:
          type: string
          description: Original query
        poll_url:
          type: string
          description: URL to poll for result
        results:
          description: Search results array
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/SearchResultItemDto'
        total_results:
          type: number
          description: Total results found
          nullable: true
        error:
          description: Error details when failed
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/SearchErrorDto'
        created_at:
          type: string
          description: ISO timestamp of creation
        completed_at:
          type: string
          description: ISO timestamp of completion
          nullable: true
      required:
        - id
        - status
        - type
        - query
        - created_at
    SearchAcceptedDto:
      type: object
      properties:
        id:
          type: string
          description: Search operation ID
        status:
          type: string
          enum:
            - queued
        poll_url:
          type: string
          description: URL to poll for result
        meta:
          $ref: '#/components/schemas/SearchAcceptedMetaDto'
      required:
        - id
        - status
        - poll_url
        - meta
    PublicErrorResponseDto:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        error:
          type: string
          example: Bad Request
        message:
          type: string
          example: Validation failed
        path:
          type: string
          example: /api/v1/search
        requestId:
          type: string
          example: 506af9b3-01a9-43be-9eb4-8458fe3e4f5b
        timestamp:
          type: string
          example: '2026-05-21T09:08:10.000Z'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/PublicValidationErrorItemDto'
      required:
        - statusCode
        - error
        - message
        - path
        - timestamp
    SearchResultItemDto:
      type: object
      properties:
        url:
          type: string
          description: Result URL
        title:
          type: string
          description: Result title
        content:
          type: string
          description: Content snippet or post text
          nullable: true
        published_at:
          type: string
          description: Published date (ISO)
          nullable: true
        author_name:
          type: string
          description: Author name (LinkedIn)
          nullable: true
        author_headline:
          type: string
          description: Author headline (LinkedIn)
          nullable: true
        id:
          type: string
          description: Source-native stable entity ID, when available
          nullable: true
        platform_video_id:
          type: string
          description: Source-native stable post/video/activity ID, when available
          nullable: true
        post_url:
          type: string
          description: Source-native canonical post URL, when available
          nullable: true
        author_username:
          type: string
          description: Author handle or username, when available
          nullable: true
      required:
        - url
        - title
    SearchErrorDto:
      type: object
      properties:
        message:
          type: string
          description: Safe error message
        retryable:
          type: boolean
          description: Whether retrying the search may succeed
      required:
        - message
        - retryable
    SearchAcceptedMetaDto:
      type: object
      properties:
        request_id:
          type: string
          description: Request ID for support and tracing
      required:
        - request_id
    PublicValidationErrorItemDto:
      type: object
      properties:
        property:
          type: string
          example: body.query
        message:
          type: string
          example: query must be a string
        constraints:
          type: object
          additionalProperties:
            type: string
          example:
            isString: query must be a string
      required:
        - property
        - message
  securitySchemes:
    AccessKey:
      type: apiKey
      in: header
      name: X-Access-Key
      description: The public API key from the Credentials page.
    SecretKey:
      type: apiKey
      in: header
      name: X-Secret-Key
      description: The API secret shown when the credential is created.

````