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

# Segment-aware autocomplete



## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/search/autocomplete
openapi: 3.1.0
info:
  title: NIPOST Postcode Gateway — Public API
  version: 0.1.0
  description: >
    Public API for Nigeria's national postcode system. Search and Lookup L1 are
    free; Lookup L2–L4 are commercial (credits); L5 is restricted. Authenticate
    with an API key.
servers:
  - url: https://api.postcode.gov.ng
    description: Production
  - url: http://localhost:8081
    description: Local gateway
security:
  - ApiKeyAuth: []
paths:
  /v1/search/autocomplete:
    get:
      summary: Segment-aware autocomplete
      parameters:
        - name: q
          in: query
          required: true
          schema:
            type: string
          description: Partial postcode, e.g. 'EK 01 A'
      responses:
        '200':
          description: Suggestions for the active segment
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      segment:
                        type: string
                        enum:
                          - state
                          - lga
                          - district
                          - area
                          - unit
                      suggestions:
                        type: array
                        items:
                          type: object
                          properties:
                            code:
                              type: string
                            label:
                              type: string
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````