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

# Live SERP results

> Retrieve live Google organic SERP results for a keyword. Results are cached for 6 hours.



## OpenAPI

````yaml https://api.surnex.io/openapi.json post /v1/keywords/serp
openapi: 3.1.0
info:
  title: Surnex API
  description: |-
    Surnex SEO Platform API — api.surnex.io

    Provides the complete backend for the Surnex SEO dashboard including:
    - Multi-tenant organization management
    - Project tracking (domains)
    - Keyword rank tracking (Phase 1+)
    - Backlink analysis (Phase 3+)
    - Site auditing (Phase 4+)
    - Stripe billing integration
    - MCP endpoint for AI agents at /mcp
  version: 0.1.0
servers: []
security: []
paths:
  /v1/keywords/serp:
    post:
      tags:
        - Keywords
      summary: Live SERP results
      description: >-
        Retrieve live Google organic SERP results for a keyword. Results are
        cached for 6 hours.
      operationId: get_serp_results_v1_keywords_serp_post
      parameters:
        - name: project_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: Project ID for search history
            title: Project Id
          description: Project ID for search history
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SerpRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIResponse_SerpResponse_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SerpRequest:
      properties:
        keyword:
          type: string
          maxLength: 500
          minLength: 1
          title: Keyword
          description: Keyword to retrieve SERP results for.
        location_code:
          type: integer
          title: Location Code
          description: DataForSEO location code (e.g. 2840 = United States).
        language_code:
          type: string
          maxLength: 10
          title: Language Code
          description: Language code (e.g., 'en', 'de', 'fr').
        depth:
          type: integer
          maximum: 100
          minimum: 1
          title: Depth
          description: Number of SERP results to retrieve.
          default: 10
      type: object
      required:
        - keyword
        - location_code
        - language_code
      title: SerpRequest
      description: Request body for live SERP lookup.
    APIResponse_SerpResponse_:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          anyOf:
            - $ref: '#/components/schemas/SerpResponse'
            - type: 'null'
      type: object
      title: APIResponse[SerpResponse]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SerpResponse:
      properties:
        keyword:
          type: string
          title: Keyword
        location_code:
          type: integer
          title: Location Code
        language_code:
          type: string
          title: Language Code
        results:
          items:
            $ref: '#/components/schemas/SerpResult'
          type: array
          title: Results
        total_results:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Results
      type: object
      required:
        - keyword
        - location_code
        - language_code
        - results
      title: SerpResponse
      description: Full SERP response for a keyword.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SerpResult:
      properties:
        position:
          type: integer
          title: Position
          description: Ranking position in SERP (1-indexed).
        url:
          type: string
          title: Url
          description: Full URL of the result.
        domain:
          type: string
          title: Domain
          description: Root domain of the result.
        title:
          type: string
          title: Title
          description: Page title from SERP.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Meta description snippet.
        result_type:
          type: string
          title: Result Type
          description: Type of result (organic, featured_snippet, people_also_ask, etc.).
          default: organic
        serp_features:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Serp Features
          description: SERP features associated with this result.
        breadcrumb:
          anyOf:
            - type: string
            - type: 'null'
          title: Breadcrumb
          description: Breadcrumb trail for the result.
        page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page
          description: SERP page number this result appears on.
        rating:
          anyOf:
            - type: number
            - type: 'null'
          title: Rating
          description: Rating value (local_pack, hotels).
        review_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Review Count
          description: Number of reviews (local_pack).
        price:
          anyOf:
            - type: string
            - type: 'null'
          title: Price
          description: Price string (shopping, hotels).
        image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Url
          description: Image URL (shopping, images).
        video_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Video Id
          description: Video ID (videos).
        duration:
          anyOf:
            - type: string
            - type: 'null'
          title: Duration
          description: Video duration (videos).
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
          description: Source name (top_stories).
        timestamp:
          anyOf:
            - type: string
            - type: 'null'
          title: Timestamp
          description: Timestamp (top_stories, events).
        items:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Items
          description: Nested items (people_also_ask questions).
      type: object
      required:
        - position
        - url
        - domain
        - title
      title: SerpResult
      description: Single SERP result item.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````