Skip to content

Event Types

The /v1/news/event-types endpoint returns every valid value for the event.type and event.category filters. Use it to populate filter UIs or to validate input before sending a request — the codes it returns are exactly the ones the news endpoints accept.

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/news/event-types

The list is static, so a single call is enough — there are no query parameters beyond authentication.

Query Parameters

ParameterTypeRequiredDescription
api_keystringYes*Your API key. Can also be provided via headers.

* Required if not provided in headers

Response Format

The endpoint returns an object with the list of categories and the list of event types:

json
{
  "status": "ok",
  "categories": ["string"],
  "event_types": [
    {
      "code": "string",
      "category": "string"
    }
  ]
}

Response Fields

FieldTypeDescription
statusstringok on success.
categoriesstring[]Valid values for the event.category filter.
event_typesobject[]Every valid event type.
event_types[].codestringValid value for the event.type / ignore.event.type filter.
event_types[].categorystringThe category this event type belongs to.

Request Examples

Using query parameter

bash
curl "https://api.apitube.io/v1/news/event-types?api_key=YOUR_API_KEY"
python
import requests

resp = requests.get(
    "https://api.apitube.io/v1/news/event-types",
    params={"api_key": "YOUR_API_KEY"},
)
print(resp.json())
javascript
const params = new URLSearchParams({ api_key: "YOUR_API_KEY" });
const resp = await fetch(`https://api.apitube.io/v1/news/event-types?${params}`);
console.log(await resp.json());
php
$query = http_build_query(["api_key" => "YOUR_API_KEY"]);
$data = json_decode(file_get_contents("https://api.apitube.io/v1/news/event-types?$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/news/event-types")
	q := u.Query()
	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/news/event-types?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/news/event-types

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

Using header authentication

shell
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.apitube.io/v1/news/event-types"

Using Bearer token

shell
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.apitube.io/v1/news/event-types"

Response Example

Truncated — the live response lists every event type across the three categories.

json
{
  "status": "ok",
  "categories": ["business", "society", "environment"],
  "event_types": [
    { "code": "merger-acquisition", "category": "business" },
    { "code": "ipo", "category": "business" },
    { "code": "layoffs", "category": "business" },
    { "code": "election", "category": "society" },
    { "code": "protest", "category": "society" },
    { "code": "earthquake", "category": "environment" },
    { "code": "wildfire", "category": "environment" }
  ]
}

Using the values

bash
# Filter by a single event type
curl "https://api.apitube.io/v1/news/everything?event.type=layoffs&api_key=YOUR_API_KEY"

# Filter by a whole category
curl "https://api.apitube.io/v1/news/everything?event.category=environment&api_key=YOUR_API_KEY"

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