Authentication
A simple auth test to guarantee that your credentials work correctly.
In this guide, we'll help you validate that your credentials are correct and ensure they work properly with the other APIs. The authentication stage is critical because it serves as the gateway to accessing all other services.
1. Authentication: Requesting a Token
To authenticate and get your token, you need to send a request to the following endpoint:
POST <BaseUrl>/partners-int/login
This is where you'll send your credentials to obtain a token that will grant you access to other Paybrokers APIs.
2. Request body
In the body of your POST
request, you need to send a JSON
payload that includes your accessKey
and secret
. Here's an example of how the request body should look:
{
"accessKey": "••••••",
"secret": "••••••"
}
Make sure to replace •••••• with your actual accessKey and secret, which you should have received from Paybrokers
3. Request Fields Explanation
The table below explains the fields required in the request body:
Field | Type | Required | Description |
---|---|---|---|
accessKey | string | true | The access key created in the admin portal |
secret | string | true | The secret associated to the key |
Important:
Do not share your credentials with anyone outside of your organization.
4. Example of an Authentication Request
Here’s an example of how to create an authentication request using cURL:
curl --location 'https://<baseurl>/partners-int/login' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"accessKey": "••••••",
"secret": "••••••"
}'
This cURL command sends a POST request to the API, passing the necessary headers and the credentials in the request body.
5. Possible Responses
The API will return different responses depending on the outcome of your request. Below are the possible responses you might receive:
eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJlNTkxZTZhNC0wYWJjLTRjZmItODMyOS1mMzg5Zjk3ZGUxNTkiLCJ1bmEiOiJjR0Y1WW5KdmEyVnljMkp5WVc1a01RPT0iLCJhciI6WyJQYXJ0bmVyQWRtaW4iLCJQYXJ0bmVyRGVmYXVsdCJdLCJhayI6IjBlZjllMzExLTA4NjQtNDRiZi04MzM1LTFlYzIzZjg4ODcwZCIsInJlYWxtIjoiUGFydG5lciIsImNhIjoiYjc3M2M2MGEtMDU1MC00MzFlLTk0YTctMjRhNzYyNTk0ZTAzIiwiY2lkIjoiOTk0NGE5YWQtOGViZC00Mjc4LThiNGItNzNjNTdkYTQxMDQyIiwiZG9tYWluIjoiL3BhcnRuZXJzLWludCIsImlhdCI6MTczNDk4Mjg4NiwiZXhwIjoxNzM1ODQ2ODg3fQ.CakkWI3B45Vpg1DK8bHGCGAIj0anLeYoPN24Rynt5JgIMO9u5FtizVtAkUPbcb8j
{
"statusCode": "Error",
"error": {
"name": "<string>",
"message": "<string>",
"details": [
{
"path": "<string>",
"code": "<string>",
"message": "<string>",
"info": {}
},
{
"path": "<string>",
"code": "<string>",
"message": "<string>",
"info": {}
}
]
}
}
{
"message": "Forbidden"
}
{
"statusCode": "Error",
"error": {
"name": "<string>",
"message": "<string>"
}
}
Ready to Access Other Services
Once you successfully receive the authentication token, you can use it to access other services in the Paybrokers API. Be sure to include the token in the Authorization header of subsequent API requests.
Good luck with your integration!🚀
Updated 2 months ago