> **For AI agents:** this page is a focused, LLM-optimized view of a
> single Fiber AI operation. Before calling it, fetch the routing
> instructions at [`https://api.fiber.ai/llms.txt`](https://api.fiber.ai/llms.txt) and the full operation
> index at [`https://api.fiber.ai/ai-docs/index.md`](https://api.fiber.ai/ai-docs/index.md).

# locationTypeahead

`POST /v1/typeahead/location`

**Tags:** `Typeaheads`

Location typeahead

**Endpoint:** `https://api.fiber.ai/v1/typeahead/location`

## Description

Get the latitude/longitude of a given city, including prefixes (e.g. 'san fr'). This makes it good for typeaheads in your UI.

⚡ Rate limit: 240 requests per 1 minute

💰 Cost: 1 credit per request ⓘ

## Request body (JSON Schema)

```json
{
  "type": "object",
  "properties": {
    "apiKey": {
      "type": "string",
      "description": "Your Fiber API key"
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "The search query for a location. Accepts a city name or ZIP/postal code, either complete (e.g. 'New York') or partial (e.g. 'san fr'). Neighborhoods, street addresses, states, and countries are not supported."
    }
  },
  "required": [
    "apiKey",
    "query"
  ]
}
```

## Response — success (JSON Schema)

```json
{
  "type": "object",
  "properties": {
    "output": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "latitude": {
                "type": "number",
                "minimum": -90,
                "maximum": 90
              },
              "longitude": {
                "type": "number",
                "minimum": -180,
                "maximum": 180
              }
            },
            "required": [
              "latitude",
              "longitude"
            ]
          }
        },
        "presetRegions": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "circle"
                    ]
                  },
                  "slug": {
                    "type": "string",
                    "enum": [
                      "sf-bay-area",
                      "sf-north-bay",
                      "sf-east-bay",
                      "sf-south-bay",
                      "sf-peninsula",
                      "greater-new-york",
                      "chicagoland",
                      "washington-dmv",
                      "greater-los-angeles",
                      "inland-empire",
                      "greater-philadelphia",
                      "boston-route-128",
                      "greater-austin",
                      "toronto-golden-horseshoe",
                      "greater-london",
                      "greater-tokyo",
                      "research-triangle",
                      "seattle-puget-sound",
                      "dallas-fort-worth",
                      "miami-south-florida",
                      "slc-silicon-slopes",
                      "denver-front-range"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "emoji": {
                    "type": "string"
                  },
                  "countryCode": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "cities": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 5
                  },
                  "synonyms": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "latitude": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "longitude": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "radiusMiles": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 12500
                  }
                },
                "required": [
                  "type",
                  "slug",
                  "name",
                  "emoji",
                  "countryCode",
                  "cities",
                  "synonyms",
                  "latitude",
                  "longitude",
                  "radiusMiles"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "polygon"
                    ]
                  },
                  "slug": {
                    "type": "string",
                    "enum": [
                      "sf-bay-area",
                      "sf-north-bay",
                      "sf-east-bay",
                      "sf-south-bay",
                      "sf-peninsula",
                      "greater-new-york",
                      "chicagoland",
                      "washington-dmv",
                      "greater-los-angeles",
                      "inland-empire",
                      "greater-philadelphia",
                      "boston-route-128",
                      "greater-austin",
                      "toronto-golden-horseshoe",
                      "greater-london",
                      "greater-tokyo",
                      "research-triangle",
                      "seattle-puget-sound",
                      "dallas-fort-worth",
                      "miami-south-florida",
                      "slc-silicon-slopes",
                      "denver-front-range"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "emoji": {
                    "type": "string"
                  },
                  "countryCode": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "cities": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 5
                  },
                  "synonyms": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "vertices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "latitude": {
                          "type": "number",
                          "minimum": -90,
                          "maximum": 90
                        },
                        "longitude": {
                          "type": "number",
                          "minimum": -180,
                          "maximum": 180
                        }
                      },
                      "required": [
                        "latitude",
                        "longitude"
                      ]
                    },
                    "minItems": 4,
                    "maxItems": 1000
                  }
                },
                "required": [
                  "type",
                  "slug",
                  "name",
                  "emoji",
                  "countryCode",
                  "cities",
                  "synonyms",
                  "vertices"
                ]
              }
            ]
          },
          "description": "Preset metro area regions matching the query. Each includes a slug usable with the preset-region strategy in location-based search endpoints, plus geometry and major cities for display."
        }
      },
      "required": [
        "data",
        "presetRegions"
      ]
    },
    "chargeInfo": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "charged-now"
              ]
            },
            "creditsCharged": {
              "type": "number"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "creditsCharged"
          ],
          "description": "Credits were charged immediately for this operation"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "charging-later"
              ]
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "message"
          ],
          "description": "Credits will be charged after the operation completes"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "charged-for-async-process"
              ]
            },
            "creditsCharged": {
              "type": "number"
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "creditsCharged",
            "message"
          ],
          "description": "Credits that were charged for an asynchronous operation"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "free"
              ]
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "message"
          ],
          "description": "No credits were charged for this operation"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "credits-refunded"
              ]
            },
            "creditsRefunded": {
              "type": "number"
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "creditsRefunded",
            "message"
          ],
          "description": "Credits were refunded for this operation"
        }
      ]
    },
    "warnings": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "Full path to extraneous field (e.g., 'searchParams.ExtraField')"
          },
          "message": {
            "type": "string",
            "description": "Warning message"
          }
        },
        "required": [
          "field",
          "message"
        ]
      },
      "description": "Warnings about extraneous fields in request"
    },
    "advice": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Tips, recommendations, and suggestions for using this API effectively."
    }
  },
  "required": [
    "output",
    "chargeInfo"
  ],
  "additionalProperties": false
}
```

---

Canonical JSON: [`https://api.fiber.ai/openapi.json`](https://api.fiber.ai/openapi.json)
Operation index: [`https://api.fiber.ai/ai-docs/index.md`](https://api.fiber.ai/ai-docs/index.md)
