Suggest Entities
The /v1/suggest/entities endpoint provides autocomplete functionality for searching entities by name prefix. This endpoint is useful for building search interfaces with entity suggestions.
To use the API, you'll require an API key. You can obtain an API key by signing up for an account on the APITube website.
Endpoint
GET /v1/suggest/entitiesThis endpoint returns a list of entities matching the provided name prefix. Results include entity details such as type, name, and links to external resources like Wikipedia and Wikidata.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prefix | string | Yes | The name prefix to search for. Minimum 1 character. |
api_key | string | Yes* | Your API key. Can also be provided via headers. |
* Required if not provided in headers
Response Format
The endpoint returns an array of entity objects with the following structure:
json
[
{
"id": "string",
"name": "string",
"type": "string",
"links": {
"self": "string",
"wikipedia": "string",
"wikidata": "string"
},
"metadata": {}
}
]Entity Types
Entities can be one of the following types:
person- Individual peoplelocation- Geographic locationsorganization- Companies, institutions, and organizationsbrand- Commercial brandsproduct- Products and servicesnatural-disaster- Natural disasters and catastrophic eventsdisease- Diseases and medical conditionsevent- Notable events
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the entity |
name | string | Name of the entity |
type | string | Type of entity (see Entity Types above) |
links.self | string | URL to get news articles about this entity |
links.wikipedia | string | Wikipedia page URL (if available) |
links.wikidata | string | Wikidata page URL (if available) |
metadata | object | Additional metadata about the entity (varies by entity type) |
Request Examples
Using query parameter
shell
curl "https://api.apitube.io/v1/suggest/entities?prefix=elon&api_key=YOUR_API_KEY"Using header authentication
shell
curl -H "X-API-Key: YOUR_API_KEY" \
"https://api.apitube.io/v1/suggest/entities?prefix=tesla"Using Bearer token
shell
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.apitube.io/v1/suggest/entities?prefix=apple"Response Example
json
[
{
"id": "Q312",
"name": "Apple Inc.",
"type": "organization",
"links": {
"self": "https://api.apitube.io/v1/news/entity/123",
"wikipedia": "https://en.wikipedia.org/wiki/Apple_Inc.",
"wikidata": "https://www.wikidata.org/wiki/Q312"
},
"metadata": {
"headquarters": {
"city": "Cupertino",
"country": "United States"
},
"founded": "1976",
"industry": "Technology"
}
},
{
"id": "Q89",
"name": "Apple",
"type": "product",
"links": {
"self": "https://api.apitube.io/v1/news/entity/456",
"wikipedia": "https://en.wikipedia.org/wiki/Apple",
"wikidata": "https://www.wikidata.org/wiki/Q89"
},
"metadata": {}
}
]Error Responses
Missing API Key
json
{
"errors": [
{
"code": "ER0200",
"message": "API key is required."
}
]
}Status Code: 400
Invalid API Key
json
{
"errors": [
{
"code": "ER0201",
"message": "API key not found."
}
]
}Status Code: 404
Missing Prefix Parameter
json
{
"errors": [
{
"code": "ER0248",
"message": "`Prefix` in query required."
}
]
}Status Code: 400