Skip to main content
POST
/
auth
/
connect
Create a token to initialize the Benji Connect SDK
curl --request POST \
  --url https://api-staging.withbenji.com/auth/connect \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "partnership_id": "<string>",
  "mode": 123,
  "display_name": "<string>",
  "user_external_id": "<string>",
  "custom_attributes": {
    "actions": [
      {
        "mode": 123,
        "amount": 123,
        "allows_editing": true
      }
    ]
  }
}
'
{
    "code": "ok",
    "data": {
        "token": "0c371a1c-aa81-11ef-b28c-0a58a9feac02",
        "connect_url": "https://connect.withbenji.com/khkgfoud76td"
    }
}

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.

The x-api-key header value to be used on this API is your partner API key, which can be generated through the Developer page in Pilot.
The Connect Token API resolves merchant and partner from partnership_id.

Request body

partnership_id
string
required
The unique identifier of the partnership on the Benji Platform.
mode
number
required
The connection mode for the SDK (Connect = 1, Transfer = 3, and Redeem = 4). See Connect modes.
display_name
string
Display name shown in the Connect UI. If omitted, the name configured for the partnership on the platform is used.
user_external_id
string
A unique identifier for the user in your system. When set, the flow can skip the authentication step for your user.
custom_attributes
object
Custom attributes for the connection flow (e.g. transfer actions).

Example requests

{
    "partnership_id": 49,
    "mode": 1,
    "display_name": "Reward Cookies"
}
{
    "partnership_id": 49,
    "mode": 1,
    "display_name": "Reward Cookies",
    "user_external_id": "user-1234"
}
{
    "partnership_id": 49,
    "mode": 3,
    "display_name": "Reward Cookies",
    "custom_attributes": {
        "actions": [
            {
                "mode": 3,
                "amount": 1000,
                "allows_editing": true
            }
        ]
    }
}
{
    "partnership_id": 49,
    "mode": 4,
    "display_name": "Reward Cookies"
}

Return values

token
string
required
The connect token to pass when initializing the Benji Connect SDK or as connect_token on the Benji Hosted Connect URL.
connect_url
string
Base URL for Benji Hosted Connect for this partnership. Append ?connect_token=<token> (and optional query parameters) to send users into Benji Hosted Connect. May be empty if Benji Hosted Connect URLs are not enabled for your account.
{
    "code": "ok",
    "data": {
        "token": "0c371a1c-aa81-11ef-b28c-0a58a9feac02",
        "connect_url": "https://connect.withbenji.com/khkgfoud76td"
    }
}