On this page
Suggest Entities
Send the beginning of a person, company or other entity name to /v1/suggest/entities. Use the matches to suggest names in a search box.
Sign up at APITube to get your API key. Include it with every API request.
Endpoint
GET /v1/suggest/entitiesMatches include an ID, type, name, and Wikipedia and Wikidata links.
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 response is an array of entities:
json
[
{
"id": 0,
"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 eventssport- Sportsunknown- Type could not be determined
Response Fields
| Field | Type | Description |
|---|---|---|
id | integer | 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
bash
curl "https://api.apitube.io/v1/suggest/entities?prefix=elon&api_key=YOUR_API_KEY"
python
import requests
resp = requests.get(
"https://api.apitube.io/v1/suggest/entities",
params={"prefix": "elon", "api_key": "YOUR_API_KEY"},
)
print(resp.json())
javascript
const params = new URLSearchParams({ prefix: "elon", api_key: "YOUR_API_KEY" });
const resp = await fetch(`https://api.apitube.io/v1/suggest/entities?${params}`);
console.log(await resp.json());
php
$query = http_build_query(["prefix" => "elon", "api_key" => "YOUR_API_KEY"]);
$data = json_decode(file_get_contents("https://api.apitube.io/v1/suggest/entities?$query"), true);
print_r($data);
go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/suggest/entities")
q := u.Query()
q.Set("prefix", "elon")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/suggest/entities?prefix=elon&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/suggest/entities?prefix=elon
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/everything
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": 123,
"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": 500,
"name": "Apple",
"type": "product",
"links": {
"self": "https://api.apitube.io/v1/news/entity/500",
"wikipedia": "https://en.wikipedia.org/wiki/Apple",
"wikidata": "https://www.wikidata.org/wiki/Q89"
},
"metadata": {}
}
]Error Responses
Missing API Key
json
{
"errors": [
{
"code": "ER0201",
"message": "API key is required. Provide it via X-API-Key header or api_key query parameter."
}
]
}Status Code: 401
Invalid API Key
json
{
"errors": [
{
"code": "ER0202",
"message": "API key is invalid."
}
]
}Status Code: 401
Missing Prefix Parameter
json
{
"errors": [
{
"code": "ER0346",
"message": "`Prefix` in query required."
}
]
}Status Code: 400