Authentication
The ReadyRemit API uses Bearer Authentication to authenticate API calls and keep your data and your users data safe.
To retrieve a bearer token from the ReadyRemit API, use the Get Access Token endpoint.
curl --request POST \
--url https://sandbox-api.readyremit.com/v1/oauth/token \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}",
"audience": "https://sandbox-api.readyremit.com",
"grant_type": "client_credentials"
}'
The response from this API call will include an access_token
property.
{
"access_token": "{{access_token}}",
"expires_in": 86400,
"token_type": "Bearer"
}
The access token returned in the response can be used to generate an authorization header.
Authorization: Bearer {{access_token}}
An example of getting a quote from ReadyRemit using bearer authentication can be seen below.
curl --request GET \
--url 'https://sandbox-api.readyremit.com/v1/quote?transferMethod=BANK_ACCOUNT"eBy=SEND_AMOUNT' \
--header 'accept: application/json' \
--header 'authorization: Bearer {{access_token}}'
Sender ID
There are two types of authentication possible in a ReadyRemit integration: client authentication, and sender authentication.
The first type of authentication is "client" level authentication. A token obtained using client level authentication is able to perform operations on all senders associated with your account. To obtain a "client" level access token, call the Get Access Token API without passing in a sender ID.
The second type of authentication is "sender" level authentication. A token obtained using sender level authentication is only allowed to perform operations in the context of that sender. This type of authentication should always be used when generating a token to send to the ReadyRemit SDK. To to retrieve a "sender" level authorization token, call the Get Access Token API and include the sender ID.
Below is an example of retrieving an access token using "sender" level authentication:
curl --request POST \
--url https://sandbox-api.readyremit.com/v1/oauth/token \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}",
"audience": "https://sandbox-api.readyremit.com",
"grant_type": "client_credentials",
"sender_id": "{{sender_id}}"
}'
Updated over 1 year ago