Create Token
Allows a partner to post information to Flex and get a token back. This token is then handed to the SDK.
note
This endpoint is hosted by Flex. Partners call this endpoint to create tokens that allow their users to interact with Flex.
Endpoint
POST /v1/sbi/token
Base URL: https://partner-bridge.{env}.getflex.com
Request
Headers
| Header | Type | Required | Description |
|---|---|---|---|
X-Client-Id | string | Yes | Your client ID (provided by Flex) |
X-Api-Key | string | Yes | Your API key (provided by Flex) |
Content-Type | string | Yes | Must be application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
first_name | string | Yes | Customer's first name |
last_name | string | Yes | Customer's last name |
email | string | Yes | Customer's email address |
phone_number | string | Yes | Customer's phone number (E.164 format recommended) |
address | object | Yes | Customer's address |
balance | object | No | Current balance information |
external_identifiers | object | No | Partner-specific identifiers |
Address Object
| Field | Type | Required | Description |
|---|---|---|---|
address_line_1 | string | Yes | Street address |
address_line_2 | string | No | Apartment, suite, unit, etc. |
city | string | Yes | City |
state | string | Yes | Two-letter state code |
zip | string | Yes | ZIP code |
Balance Object
| Field | Type | Description |
|---|---|---|
amount_due_in_cents | integer | Amount due in cents |
due_date | string | Due date (ISO 8601 date format: YYYY-MM-DD) |
last_updated_at | string | Last update timestamp (ISO 8601 datetime format) |
External Identifiers
Identifiers in the Partner's system Flex will use to communicate about this user.
| Field | Type | Required | Description |
|---|---|---|---|
biller_id | string | Yes for Bill Aggregators, No otherwise | Partner's biller identifier |
account_id | string | Yes | Partner's account identifier |
Example Request
POST /v1/sbi/token HTTP/1.1
Host: https://partner-bridge.qa.getflex.com
X-Client-Id: your_client_id
Content-Type: application/json
{
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone_number": "+12125550123",
"address": {
"address_line_1": "123 Main Street",
"address_line_2": "Apt 4B",
"city": "New York",
"state": "NY",
"zip": "10001"
},
"balance": {
"amount_due_in_cents": 150000,
"due_date": "2025-02-01",
"last_updated_at": "2025-01-15T10:30:00Z"
},
"external_identifiers": {
"biller_id": "BID-8F3A9C2D",
"account_id": "ACCT-95899380",
}
}
Response
Success (200 OK)
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response Fields
| Field | Type | Description |
|---|---|---|
token | string | A token that can be used to initiate the Flex payment flow for this user |
Error Responses
404 Not Found
Returned when the client ID is not recognized or the account cannot be found.
{
"code": "NOT_FOUND",
"message": "Resource not found"
}
500 Internal Server Error
Returned when an unexpected error occurs on the Flex side.
{
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
Token Usage
The returned token is used to open the Embed SDK. See the Embed SDK docs for more details.