Skip to main content
POST
/
auth
/
connect
Create a token to initialize the SDK
curl --request POST \
  --url https://api-staging.withbenji.com/auth/connect \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "display_name": "<string>",
  "mode": 123,
  "partnership_id": "<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"
    }
}
The x-api-key header value to be used on this API is your partner API key, which can be generated through the dashboard.
display_name
string
The partnership display name you wish to be shown in the Benji Connect flow UI Note: If this is not passed, the name configured on the Benji platform will be used.
mode
number
required
The connection mode for the SDK (Connect = 1, Transfer = 3, and Redeem = 4)
partnership_id
string
required
The unique identifier of the partnership on the Benji Platform.
user_external_id
string
A unique identifier associated with the user connecting their loyalty reward program, when set flow skips the initial user authorization with the partner and continues to authorize the user with the related merchant/partner.
custom_attributes
object
Custom attributes for the connection flow

Example Requests

{
    "mode": 1,
    "display_name": "Reward Cookies",
    "partner_id": 3,
    "partnership_id": 49,
    "merchant_id": 48
}
{
    "mode": 1,
    "display_name": "Reward Cookies",
    "partner_id": 3,
    "partnership_id": 49,
    "merchant_id": 48,
    "user_external_id": "1234"
}
{
    "mode": 3,
    "display_name": "Reward Cookies",
    "partner_id": 3,
    "partnership_id": 49,
    "merchant_id": 48,
    "custom_attributes": {
        "actions": [
            {
                "mode": 3,
                "amount": 1000,
                "allows_editing": true
            }
        ]
    }
}

Return values

token
string
required
The created token token to use when initializing the Benji Connect SDK
connect_url
string
required
For accounts with hosted urls enabled, the URL to redirect the user to in order to complete the connection flow. Empty for accounts without hosted urls enabled.
{
    "code": "ok",
    "data": {
        "token": "0c371a1c-aa81-11ef-b28c-0a58a9feac02",
        "connect_url": "https://connect.withbenji.com/khkgfoud76td"
    }
}