Skip to content

Suggest Sources

The /v1/suggest/sources endpoint provides autocomplete functionality for searching news sources by name or domain prefix. It is useful for building filter interfaces: the returned id can be passed directly to the source.id parameter of the news endpoints.

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/sources

The search matches both the source name and its domain. Results are returned as an array of source objects.

Query Parameters

ParameterTypeRequiredDescription
prefixstringYesThe name or domain prefix to search for. Minimum 1 character.
api_keystringYes*Your API key. Can also be provided via headers.

* Required if not provided in headers

Response Format

The endpoint returns an array of source objects with the following structure:

json
[
  {
    "id": 0,
    "name": "string",
    "domain": "string",
    "type": "string",
    "bias": "string",
    "links": {
      "self": "string"
    }
  }
]

Response Fields

FieldTypeDescription
idintegerSource identifier. Use it directly in the source.id filter.
namestringSource name
domainstringSource domain
typestring | nullResource type (e.g. news, blog)
biasstring | nullPolitical bias of the source: left, center, or right
links.selfstringURL to get news articles from this source (/v1/news/everything?source.id=...)

Request Examples

Using query parameter

shell
curl "https://api.apitube.io/v1/suggest/sources?prefix=bbc&api_key=YOUR_API_KEY"

Using header authentication

shell
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.apitube.io/v1/suggest/sources?prefix=guardian"

Using Bearer token

shell
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.apitube.io/v1/suggest/sources?prefix=reuters"

Response Example

json
[
  {
    "id": 1024,
    "name": "BBC News",
    "domain": "bbc.com",
    "type": "news",
    "bias": "center",
    "links": {
      "self": "https://api.apitube.io/v1/news/everything?source.id=1024"
    }
  }
]

Error Responses

Missing or Invalid 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

Missing Prefix Parameter

json
{
  "errors": [
    {
      "code": "ER0346",
      "message": "`Prefix` in query required."
    }
  ]
}

Status Code: 400