Skip to main content

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

HeaderTypeRequiredDescription
X-Client-IdstringYesYour client ID (provided by Flex)
X-Api-KeystringYesYour API key (provided by Flex)
Content-TypestringYesMust be application/json

Request Body

FieldTypeRequiredDescription
first_namestringYesCustomer's first name
last_namestringYesCustomer's last name
emailstringYesCustomer's email address
phone_numberstringYesCustomer's phone number (E.164 format recommended)
addressobjectYesCustomer's address
balanceobjectNoCurrent balance information
external_identifiersobjectNoPartner-specific identifiers

Address Object

FieldTypeRequiredDescription
address_line_1stringYesStreet address
address_line_2stringNoApartment, suite, unit, etc.
citystringYesCity
statestringYesTwo-letter state code
zipstringYesZIP code

Balance Object

FieldTypeDescription
amount_due_in_centsintegerAmount due in cents
due_datestringDue date (ISO 8601 date format: YYYY-MM-DD)
last_updated_atstringLast update timestamp (ISO 8601 datetime format)

External Identifiers

Identifiers in the Partner's system Flex will use to communicate about this user.

FieldTypeRequiredDescription
biller_idstringYes for Bill Aggregators, No otherwisePartner's biller identifier
account_idstringYesPartner'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

FieldTypeDescription
tokenstringA 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.