Endpoints
Get Autocomplete
Description
This endpoint provides Google autocomplete suggestions based on a query.
Endpoint
POST /api/v1/get-autocomplete
Headers
- Content-Type:
application/json
- Authorization: Bearer
<API_KEY>
(required)
Request Body
{
"query": "string", // Required. The base query for which autocomplete suggestions are needed.
"location": "string", // Optional. Location for contextualizing autocomplete suggestions.
"country": "string", // Optional. Country code to refine suggestions. e.g., "US", "AU".
"language": "string" // Optional. Language code for the suggestions. e.g., "en".
}
Responses
Success (200)
Returns the autocomplete suggestions for the provided query.
{
"searchParameters": {
"q": "Dumpling ai",
"type": "autocomplete",
"engine": "google"
},
"suggestions": [
{
"value": "dumpling air fryer"
},
{
"value": "dumpling ai"
},
{
"value": "dumpling airpod case"
},
{
"value": "dumpling air purifier"
},
{
"value": "dumpling air fryer time"
},
{
"value": "dumpling airport west"
},
{
"value": "dumpling airport"
},
{
"value": "can you air fry dumpling"
},
{
"value": "can you do dumplings in an air fryer"
},
{
"value": "can i put dumplings in the air fryer"
}
]
}
- Content-Type: application/json
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if the request is invalid.
{
"error": "Error message describing the issue"
}
Unauthorized (401)
Returned if the API key is invalid or missing.
{
"error": "Invalid or missing Authorization header"
}
Internal Server Error (500)
Returned if there’s an error during the autocomplete process.
{
"error": "Failed to perform autocomplete: [error message]"
}
Example Request
curl -X POST https://app.dumplingai.com/api/v1/get-autocomplete \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "Dumpling ai",
"location": "Sydney",
"country": "AU",
"language": "en"
}'
Notes
- The
location
,country
, andlanguage
fields are optional and can be used to refine the suggestions based on geographic and linguistic context. - You can find a list of supported locations at GET:
/api/v1/google-locations
- Credit usage:
- Each autocomplete request consumes 3 credits.
Rate Limiting
Rate limit headers (X-RateLimit-Limit
and X-RateLimit-Remaining
) are included in the response to indicate the user’s current rate limit status.