> This page is for Analytics API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://documentation.babelstreet.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.babelstreet.com/_mcp/server.

# Extracts events from a document.

POST https://analytics.babelstreet.com/rest/v1/events
Content-Type: application/json

Returns each event extracted from the input. The response is a list of event mentions. Each event includes a list of roles as well as any negation cues. 

Reference: https://documentation.babelstreet.com/analytics/text-analytics/event-extractor/extracts-events-from-a-document

## Authentication

- `X-BabelStreetAPI-Key` header (required) — API Key authentication via header
- `X-RosetteAPI-Key` header (required) — API Key authentication via header

## Servers

- `https://analytics.babelstreet.com/rest/v1` (https://analytics.babelstreet.com/rest/v1/, default)
- `https://api.rosette.com/rest/v1` (https://api.rosette.com/rest/v1/)

## Request

### Body (application/json)

This endpoint expects an EventRequest.

- `language` (string, optional) — 3 letter code of language.
- `options` (EventRequestOptions, optional)

## Response

### 200

OK

- `events` (list of Event, optional) — list of extracted events

## Types

### EventRequestOptions

- `workspaceId` (string, optional) — The id of a single events workspace (model)
- `plan` (string, optional) — A list of languages and workspaces. Allows multiple event models to be used in a single call
- `negation` (enum, optional, default: ignore) — Determines whether to evaluate the event for negation
  - Allowed values: `ignore`, `both`, `only_positive`, `only_negative`

### Event

- `eventType` (string, optional)
- `mentions` (list of RoleOffsets, optional)
- `confidence` (double, optional) — confidence score (0.0.-1.0)
- `workspaceId` (string, optional) — identifier of the event model that extracted the event

### RoleOffsets

- `startOffset` (integer, optional)
- `endOffset` (integer, optional)
- `roles` (list of Roles, optional)
- `polarity` (string, optional) — whether the event happened or didn't happen
- `negationCues` (list of NegationOffsets, optional) — value of how negation cues should be extracted

### Roles

- `startOffset` (integer, optional)
- `endOffset` (integer, optional)
- `name` (string, optional) — name of the role type
- `id` (string, optional)
- `dataSpan` (string, optional) — text of the role
- `confidence` (string, optional)
- `extractorName` (string, optional) — name of the extractor used to extract the role
- `roleType` (string, optional)

### NegationOffsets

- `startOffset` (integer, optional)
- `endOffset` (integer, optional)
- `dataSpan` (string, optional) — text value of the negation cues

## Examples

### travel

**Request**

```json
{
  "content": "On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela."
}
```

**Response**

```json
{
  "events": [
    {
      "eventType": "string",
      "mentions": [
        {
          "startOffset": 1,
          "endOffset": 1,
          "roles": [
            {
              "startOffset": 1,
              "endOffset": 1,
              "name": "string",
              "id": "string",
              "dataSpan": "string",
              "confidence": "string",
              "extractorName": "string",
              "roleType": "string"
            }
          ],
          "polarity": "string",
          "negationCues": [
            {
              "startOffset": 1,
              "endOffset": 1,
              "dataSpan": "string"
            }
          ]
        }
      ],
      "confidence": 1.1,
      "workspaceId": "string"
    }
  ]
}
```

**SDK Code**

```python travel
import requests

url = "https://analytics.babelstreet.com/rest/v1/events"

payload = { "content": "On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela." }
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript travel
const url = 'https://analytics.babelstreet.com/rest/v1/events';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"content":"On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go travel
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/events"

	payload := strings.NewReader("{\n  \"content\": \"On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela.\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby travel
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"content\": \"On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela.\"\n}"

response = http.request(request)
puts response.read_body
```

```java travel
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/events")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"content\": \"On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela.\"\n}")
  .asString();
```

```php travel
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/events', [
  'body' => '{
  "content": "On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela."
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp travel
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/events");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"content\": \"On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift travel
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["content": "On Tuesday, April 25, Principal Deputy National Security Advisor Jon Finer traveled to Colombia to lead the interagency U.S. delegation for the international conference on Venezuela."] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### meet

**Request**

```json
{
  "content": "While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week."
}
```

**Response**

```json
{
  "events": [
    {
      "eventType": "string",
      "mentions": [
        {
          "startOffset": 1,
          "endOffset": 1,
          "roles": [
            {
              "startOffset": 1,
              "endOffset": 1,
              "name": "string",
              "id": "string",
              "dataSpan": "string",
              "confidence": "string",
              "extractorName": "string",
              "roleType": "string"
            }
          ],
          "polarity": "string",
          "negationCues": [
            {
              "startOffset": 1,
              "endOffset": 1,
              "dataSpan": "string"
            }
          ]
        }
      ],
      "confidence": 1.1,
      "workspaceId": "string"
    }
  ]
}
```

**SDK Code**

```python meet
import requests

url = "https://analytics.babelstreet.com/rest/v1/events"

payload = { "content": "While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week." }
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript meet
const url = 'https://analytics.babelstreet.com/rest/v1/events';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"content":"While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go meet
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/events"

	payload := strings.NewReader("{\n  \"content\": \"While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week.\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby meet
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"content\": \"While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week.\"\n}"

response = http.request(request)
puts response.read_body
```

```java meet
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/events")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"content\": \"While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week.\"\n}")
  .asString();
```

```php meet
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/events', [
  'body' => '{
  "content": "While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week."
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp meet
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/events");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"content\": \"While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift meet
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["content": "While in Colombia, Finer met with President Gustavo Petro. He also met with Foreign Minister Alvaro Leyva, Chief of Staff Laura Sarabia, Minister of Justice and Law Nestor Ivan Osuna, and Deputy Finance Minister Gonzalo Hernandez Jimenez to follow up on the recent bilateral meeting between President Biden and President Petro in Washington last week."] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### negation

**Request**

```json
{
  "language": "eng",
  "options": {
    "negation": "both"
  },
  "content": "President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\""
}
```

**Response**

```json
{
  "events": [
    {
      "eventType": "string",
      "mentions": [
        {
          "startOffset": 1,
          "endOffset": 1,
          "roles": [
            {
              "startOffset": 1,
              "endOffset": 1,
              "name": "string",
              "id": "string",
              "dataSpan": "string",
              "confidence": "string",
              "extractorName": "string",
              "roleType": "string"
            }
          ],
          "polarity": "string",
          "negationCues": [
            {
              "startOffset": 1,
              "endOffset": 1,
              "dataSpan": "string"
            }
          ]
        }
      ],
      "confidence": 1.1,
      "workspaceId": "string"
    }
  ]
}
```

**SDK Code**

```python negation
import requests

url = "https://analytics.babelstreet.com/rest/v1/events"

payload = {
    "language": "eng",
    "options": { "negation": "both" },
    "content": "President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\""
}
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript negation
const url = 'https://analytics.babelstreet.com/rest/v1/events';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"language":"eng","options":{"negation":"both"},"content":"President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\""}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go negation
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/events"

	payload := strings.NewReader("{\n  \"language\": \"eng\",\n  \"options\": {\n    \"negation\": \"both\"\n  },\n  \"content\": \"President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\\\"\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby negation
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"language\": \"eng\",\n  \"options\": {\n    \"negation\": \"both\"\n  },\n  \"content\": \"President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\\\"\"\n}"

response = http.request(request)
puts response.read_body
```

```java negation
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/events")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"language\": \"eng\",\n  \"options\": {\n    \"negation\": \"both\"\n  },\n  \"content\": \"President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\\\"\"\n}")
  .asString();
```

```php negation
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/events', [
  'body' => '{
  "language": "eng",
  "options": {
    "negation": "both"
  },
  "content": "President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\\""
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp negation
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/events");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"language\": \"eng\",\n  \"options\": {\n    \"negation\": \"both\"\n  },\n  \"content\": \"President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\\\"\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift negation
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "language": "eng",
  "options": ["negation": "both"],
  "content": "President Biden decided not to fly to the conference in Georgia last Thursday. He traveled back to the White House on Friday\""
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```