# Creating a Real Time Activation Using Real-time Personalization API

This API allows you to ingest an event and receive a personalization response from Treasure Data's real-time system.

* [Prerequisites](/products/customer-data-platform/real-time/creating-a-real-time-activation-using-the-rest-api#prerequisites)
* [Endpoints and Base URLs](/products/customer-data-platform/real-time/creating-a-real-time-activation-using-the-rest-api#endpoints-and-base-urls)
* [Headers](/products/customer-data-platform/real-time/creating-a-real-time-activation-using-the-rest-api#headers)
* [Personalization API Definition](/products/customer-data-platform/real-time/creating-a-real-time-activation-using-the-rest-api#personalization-api-definition)
* [Request Body](/products/customer-data-platform/real-time/creating-a-real-time-activation-using-the-rest-api#request-body)
* [Responses](/products/customer-data-platform/real-time/creating-a-real-time-activation-using-the-rest-api#responses)


## Prerequisites

To successfully make the Real-time Personalization API call, you need to do the following things:

* Enable your account to access real-time services in the Treasure Console.
* Configure a database for Web Personalization with a detailed knowledge of the events and offers configured.
* A write-only API key
* A valid Web Personalization token.


## Endpoints and Base URLs

The personalization API uses these Base URLs.

| Region | Base URL |
|  --- | --- |
| US (us01) | https://us01.p13n.in.treasuredata.com |
| Europe (eu01) | https://eu01.p13n.in.treasuredata.com |
| Japan (ap01) | https://ap01.p13n.in.treasuredata.com |


The full URL for the personalization API is

{baseURL}/{database}/{table}

Here is an example:

`https://us01.p13n.in.treasuredata.com/personalization__database/preferences_table`

## Headers

These are the required headers for the API call.

| Name | Content |
|  --- | --- |
| Content-Type
 | Vendor-specific JSON
application vnd.treasuredata.v1+json
 |
| WP13n-Token
 | Concatenated Token
The token is created by combining the following elements:
{account id}/{instance id}/{token}
For example, for account ID 1, instance ID 8, and a valid Web Personalization token, the token would be formatted as follows `1/8/12345789abcdef••••••••••••••••••`
 |
| Authorization
 | Treasure API Key
`TD1 1/abcdef••••••••••••••••••••••0123456789`
 |


## Personalization API Definition

| HTTP Verb | Resource | Description |
|  --- | --- | --- |
| POST | /{database}/{tables} | Get offers for request |


## Request Body

[In progress: Pardon our dust]

## Responses

**204 Successful Ingestion**

**400 Bad Request**

* 3000: RT token was not provided (X-Token header)
* 3001: RT token is not in the configuration
* 3002: RT token account conflicts with Authed user account
* 3003: RT token is in an invalid format
* 3004: Invalid event object.


**429 Too Many Requests**

* 2003: Kinesis error due to limit being exceeded
* 2013: Lambda total concurrent execution exceeds the reserved concurrency


**500 Internal Server Error**

* 9999: Unknown/undiagnosed
* 1001: Treasure API is unreachable or timed out
* 1002: Table API is unreachable or timed out
* 1003: Kinesis is unreachable or timed out
* 1004: Lambda is unreachable or timed out
* 1005: MemoryDB is unreachable or timed out
* 2001: Kinesis stream was not found
* 2002: Kinesis operation threw an error
* 2011: Lambda function was not found
* 2012: Lambda function threw an error, or the response was unhandled
* 2014: Lambda invocation failed
* 2015: Lambda reactor configuration doesn't have the token yet
* 2021: MemoryDB operation threw an error
* 3010: RT Token is configured with a reactor whose token is inconsistent (account or reactor ID)