> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withbenji.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a transaction token

> Create a token to authenticate the transaction and use in the create transaction API

> [!NOTE]
>
> The `x-api-key` header value to be used on this API is a **user-based access token**.

**transaction\_amount** `integer` *required*

The total amount of the transaction.

**external\_transaction\_id** `string` *required*

The unique identifier in your system of the order transaction.

**campaign\_id** `integer`

The ID of the [campaign](https://docs.withbenji.com/api-reference/endpoint/campaigns/get) associated with the transaction. Note that in cases of a single running campaign, this field is optional.

**partner\_id** `integer`

For marketplace-only scenarios, if the user pre-selected a partner to earn or redeem points on. When not passed, the user's default loyalty partner will be used.

### Return values

**transaction\_token** `string` *required*

The transaction token to use when calling the create transaction API

**authentication\_status** `integer` *required*

Integer representing an enum of one of the following transaction authentication status values:

**possible transaction authentication status values**

* **AUTHENTICATED (1)** : Transaction is authenticated \\

* **INSUFFICIENT\_REWARDS\_AMOUNT (2)** : Member does not have sufficient rewards for the transaction  \\

* **MEMBER\_NOT\_EXISTS (3)** : The user does not have a valid loyalty account with the partner currently  \\

* **ERROR (4)** : General error when authenticating the transaction

```json 200 theme={null}
{
    "code": "ok",
    "data": {
        "authentication_id": "016bb1f6-ab4e-11ef-a1a8-0a58a9feac02",
        "authentication_status": 1
    }
}
```

```json 401 theme={null}
{
  "error": "unauthorized_user",
  "message": "Invalid key, or key is not authorized to make this call"
}
```

```json 500 theme={null}
{
  "error": "unexpected_error",
  "message": "An unexpected error has occurred"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.