> Toden documentation. For the full index fetch /llms.txt. Every page is available as Markdown by appending .md to its URL. Identity verification uses /api/kyc, Risk Intelligence uses /api/v1; they are separate contracts with different error shapes. Never invent an endpoint, field or enum value: read the API reference page for the operation first.

# Submit an event for scoring

POST https://sandbox-api.toden.co/api/identity/events
Content-Type: application/json

Scores one transaction or customer action and returns the decision. This is the compatibility endpoint for the older free-form event shape; new integrations should use the transactions and activities endpoints of the Risk Intelligence API.

**Idempotency.** `externalEventId` is the idempotency key within your organisation and environment. Sending the same event again returns the stored decision with status `200` and does not score, alert or bill a second time. Reusing the identifier with different content is refused with `409`.

**Status.** A recognised activity type returns `201` when first assessed and `200` on a replay. Every other event type returns `200`. With `async: true` where queued scoring is available the response is `202` and the decision is delivered by the `event.flagged` webhook.

**Side effects.** A decision other than `ALLOW` can raise or update an alert, returned as `alertId`. Events scored outside the recognised activity types also fire the `event.flagged` webhook for a `REVIEW` or `BLOCK` decision. When monitoring is switched off for your organisation the event is accepted and answered `ALLOW` with an empty `id`, and nothing is stored.

**Billing.** Scoring is billed in production only, where event monitoring is billed for your organisation. Sandbox events are free, and a replay is never billed again.

**Error codes**

| `error` | Status | Meaning |
|---|---|---|
| `invalid_request` | 400 | The body failed validation. `details` carries the field-level breakdown. |
| `insufficient_wallet` | 402 | The credit balance cannot cover the assessment. `activityId` names the held activity. |
| `subject_not_found` | 404 | The customer could not be resolved in this organisation and environment. |
| `idempotency_conflict` | 409 | The `externalEventId` was already used for different content. |
| `transaction_id_conflict` | 409 | The transaction identifier was already used for a different transaction. |
| `secret_key_required` | 403 | A publishable key was used. This API accepts secret keys only. |
| `environment_mismatch` | 403 | The key belongs to an environment this host does not serve. |
| `rate_limited` | 429 | The request rate limit for this key was reached. Retry after a short wait. |
| `rate_limit_store_unavailable` | 503 | Rate limiting is temporarily unavailable. Retry shortly. |

A missing or unknown key returns `401` with a plain sentence in `error` rather than a code.

Any other assessment failure is also returned as `503` with its own code in `error`; retry with the same identifiers.

Requires a secret (`sk_`) key. A publishable key receives `403 secret_key_required`.

Reference: https://docs.toden.co/api-reference/verification/events-and-signals/submit-monitoring-event

## Authentication

- `Authorization` header (bearer token, required) — Send the API key as a Bearer token. Each operation states whether a publishable key is enough or a secret key is required.

## Servers

- `https://sandbox-api.toden.co` (Sandbox, default)
- `https://api.toden.co` (Production)

## Request

### Headers

- `X-Request-Id` (string, optional) — Your own request identifier, recorded with the assessment.

### Body (application/json)

This endpoint expects a MonitoringEventRequest.

- `externalUserId` (string, required) — Your own reference for the customer the event belongs to.
- `externalEventId` (string, required) — Your own unique identifier for the event. It is the idempotency key.
- `type` (string, required) — A free-form event name, such as `transaction.transfer` or `session.login`. Names containing transaction, payment, transfer, login, sign-in, sign-up, register, password reset, beneficiary add, profile change, device change, payout or withdraw are assessed as that kind of activity.
- `data` (map from string to any, optional) — Free-form details used for scoring. Recognised keys include `amount`, `currency`, `direction`, `counterparty`, `channel`, `method`, `country`, `transactionId`, `deviceHash` and `location` (`city`, `region`, `country`, `latitude`, `longitude`, `accuracyRadiusKm`). A transaction-like event is assessed as a transaction only when both `amount` and `currency` are present.
- `async` (boolean, optional) — Set to true to queue the event and receive the decision by webhook instead of in the response. Honoured only where queued scoring is available; otherwise the event is scored in the request as usual.

## Response

### 200

The event was scored, or a stored decision was replayed.

- `id` (string, required) — The identifier of the stored event or activity. Empty when monitoring is switched off for your organisation.
- `decision` (string, required) — The verdict in upper case: `ALLOW`, `REVIEW` or `BLOCK`. An event that could not be scored yet returns `PENDING`, `RESCORING` or `PENDING_CREDIT`, which are not verdicts; send the same event again later.
- `riskScore` (double, required) — The risk score. Events assessed as a recognised activity return a value from 0 to 1; all other events return a value from 0 to 100.
- `alertId` (string, required, nullable) — The identifier of the alert raised or updated by this event, when the decision was not `ALLOW`.

### 201

A recognised activity was assessed for the first time.

- `id` (string, required) — The identifier of the stored event or activity. Empty when monitoring is switched off for your organisation.
- `decision` (string, required) — The verdict in upper case: `ALLOW`, `REVIEW` or `BLOCK`. An event that could not be scored yet returns `PENDING`, `RESCORING` or `PENDING_CREDIT`, which are not verdicts; send the same event again later.
- `riskScore` (double, required) — The risk score. Events assessed as a recognised activity return a value from 0 to 1; all other events return a value from 0 to 100.
- `alertId` (string, required, nullable) — The identifier of the alert raised or updated by this event, when the decision was not `ALLOW`.

### 202

The event was queued for scoring.

- `id` (string, required) — The `externalEventId` you sent.
- `status` (enum, required) — Always `queued`.
  - Allowed values: `queued`

## Errors

### 400 Bad Request Error

The request body, query or path was invalid.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 401 Unauthorized Error

The Authorization header is missing, or the API key is unknown or revoked.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 402 Payment Required Error

The organisation does not have enough credit for this request.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 403 Forbidden Error

The key may not call this endpoint, or the organisation may not use this feature.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 404 Not Found Error

The resource does not exist for this organisation and environment.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 409 Conflict Error

The request conflicts with the current state of the resource.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 429 Too Many Requests Error

A rate limit was reached. Retry after a short wait.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 503 Service Unavailable Error

The service is temporarily unavailable.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

## Examples

### Example 1

**Request**

```json
{
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": {
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  }
}
```

**Response**

```json
{
  "id": "cm9x2k4m80003",
  "decision": "REVIEW",
  "riskScore": 62,
  "alertId": "cm9x2k4m80004"
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.toden.co/api/identity/events"

payload = {
    "externalUserId": "user_42",
    "externalEventId": "txn_10001",
    "type": "transaction.transfer",
    "data": {
        "amount": 48000,
        "channel": "bank_transfer",
        "counterparty": "beneficiary_998877",
        "country": "NG",
        "currency": "NGN",
        "direction": "outbound"
    }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://sandbox-api.toden.co/api/identity/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"externalUserId":"user_42","externalEventId":"txn_10001","type":"transaction.transfer","data":{"amount":48000,"channel":"bank_transfer","counterparty":"beneficiary_998877","country":"NG","currency":"NGN","direction":"outbound"}}'
};

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

```go
package main

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

func main() {

	url := "https://sandbox-api.toden.co/api/identity/events"

	payload := strings.NewReader("{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}")

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

	req.Header.Add("Authorization", "Bearer <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
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.toden.co/api/identity/events")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://sandbox-api.toden.co/api/identity/events")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.toden.co/api/identity/events', [
  'body' => '{
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": {
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.toden.co/api/identity/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": [
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.toden.co/api/identity/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()
```

### Example 2

**Request**

```json
{
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": {
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  }
}
```

**Response**

```json
{
  "id": "cm9x2k4m80003",
  "decision": "REVIEW",
  "riskScore": 62,
  "alertId": "cm9x2k4m80004"
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.toden.co/api/identity/events"

payload = {
    "externalUserId": "user_42",
    "externalEventId": "txn_10001",
    "type": "transaction.transfer",
    "data": {
        "amount": 48000,
        "channel": "bank_transfer",
        "counterparty": "beneficiary_998877",
        "country": "NG",
        "currency": "NGN",
        "direction": "outbound"
    }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://sandbox-api.toden.co/api/identity/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"externalUserId":"user_42","externalEventId":"txn_10001","type":"transaction.transfer","data":{"amount":48000,"channel":"bank_transfer","counterparty":"beneficiary_998877","country":"NG","currency":"NGN","direction":"outbound"}}'
};

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

```go
package main

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

func main() {

	url := "https://sandbox-api.toden.co/api/identity/events"

	payload := strings.NewReader("{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}")

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

	req.Header.Add("Authorization", "Bearer <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
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.toden.co/api/identity/events")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://sandbox-api.toden.co/api/identity/events")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.toden.co/api/identity/events', [
  'body' => '{
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": {
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.toden.co/api/identity/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": [
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.toden.co/api/identity/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()
```

### Example 3

**Request**

```json
{
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": {
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  }
}
```

**Response**

```json
{
  "id": "txn_10001",
  "status": "queued"
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.toden.co/api/identity/events"

payload = {
    "externalUserId": "user_42",
    "externalEventId": "txn_10001",
    "type": "transaction.transfer",
    "data": {
        "amount": 48000,
        "channel": "bank_transfer",
        "counterparty": "beneficiary_998877",
        "country": "NG",
        "currency": "NGN",
        "direction": "outbound"
    }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://sandbox-api.toden.co/api/identity/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"externalUserId":"user_42","externalEventId":"txn_10001","type":"transaction.transfer","data":{"amount":48000,"channel":"bank_transfer","counterparty":"beneficiary_998877","country":"NG","currency":"NGN","direction":"outbound"}}'
};

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

```go
package main

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

func main() {

	url := "https://sandbox-api.toden.co/api/identity/events"

	payload := strings.NewReader("{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}")

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

	req.Header.Add("Authorization", "Bearer <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
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.toden.co/api/identity/events")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://sandbox-api.toden.co/api/identity/events")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.toden.co/api/identity/events', [
  'body' => '{
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": {
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.toden.co/api/identity/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"externalUserId\": \"user_42\",\n  \"externalEventId\": \"txn_10001\",\n  \"type\": \"transaction.transfer\",\n  \"data\": {\n    \"amount\": 48000,\n    \"channel\": \"bank_transfer\",\n    \"counterparty\": \"beneficiary_998877\",\n    \"country\": \"NG\",\n    \"currency\": \"NGN\",\n    \"direction\": \"outbound\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "externalUserId": "user_42",
  "externalEventId": "txn_10001",
  "type": "transaction.transfer",
  "data": [
    "amount": 48000,
    "channel": "bank_transfer",
    "counterparty": "beneficiary_998877",
    "country": "NG",
    "currency": "NGN",
    "direction": "outbound"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.toden.co/api/identity/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()
```