Developer Center

API Playbooks

Use the comprehensive guides below to streamline your integration with Centtrip. Request access to our sandbox account for developing and testing.

Authenticate & log in

There are two possible options to authenticate; using either the ApiKey, or the OAuth flow.


Step 1: Log in

Option 1 - Authenticate using the ApiKey -

Send the ApiKey and ApiSecret, separated by a colon, in the X-Api-Key header of each request as shown below.

Option 2 - Authenticate using the OAuth flow -

Call the Token endpoint, passing in the following parameters:


POST /connect/token HTTP/1.1

Content-Type: application/x-www-form-urlencoded


Parameter Name:

Example Value:


client_id

7qcMhJ45z5kAYpiX

client_secret

mXjCFkYCQ6iM8gEGijTJELzj3cAmHo

grant_type

password

username

john.smith@centtrip.com

password

MyPassword123!

scope

openid%20profile%20api_public_v1


RESPONSE -

If your credentials are validated, the response will contain a fresh authentication token as in the example below:

Look at the expires_in property to determine when the token expires - this value is in seconds.

Step 2: Keep the authentication token

Grab the access_token from the response. This is your authentication token. From now on, your authentication token will be used as a proxy for your login credentials. You will need to submit your authentication token with all subsequent API calls. You do this in the header as shown below:

Step 3: If the token has expired

In this situation, you will get a 401 Unauthorized response and will have to request a fresh authentication token by calling the Token endpoint again.

BACK TO TOP

Check account balance

To check the balance associated with the account follow the steps below


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the
Get accounts endpoint, then grab the ‘id’ of the account which you you need to check the balance of:

Step 3: Check the balance

REQUEST -

Call the Get account balance endpoint, passing in the copied ‘id’ as accontId:

GET https://api.centtrip.com/api/v1/accounts/{accountId}/balances


Parameter Name:

accountId

Example Value:

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


401

Unauthorised

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server error

Server error

Check card balance(s)

To check the balance associated with the card follow the steps below


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account where the card you need to check belongs to from the response:

Step 3: Get card ID

Call the Get cards endpoint passing in the copied ‘id’ as the accountId, then grab the appropriate ‘id’ from the response:

Step 4: Check card balance

REQUEST -

Call the Get card balance endpoint, passing in the following parameters:

GET https://api.centtrip.com/api/v1/accounts/{accountId}/cards/{cardId}/balances


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

cardId

6d98ea63-5f85-4ca5-8ae4-a74cd5aec1a6--61ab2ebe-1a0e-49c8-8fc4-2fc7cc2bc0ea


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


401

Unauthorised

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server error

Server error


Retrieve account transactions

To retrieve transactions associated with the account follow the steps below.


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account where the card you need to check belongs to from the response:

Step 3: Retrieve account transactions

REQUEST -

Call the Get account transactions endpoint, passing in the following parameters:


GET https://api.centtrip.com/api/v1/accounts/{accountId}/transactions


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


400

Bad Request

One or more passed parameters could not been validated

401

Unauthorised

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

404

Not Found

Not a single object has been found according to the request


Retrieve card transactions

To retrieve transactions associated with the card follow the steps below


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account where the card you need to check belongs to from the response:

Step 3: Get card ID

Call the Get cards endpoint passing in the copied ‘id’ as the accountId, then grab the appropriate ‘id’ from the response:

Step 4: Retrieve card transactions

REQUEST -

Call the Get card transactions endpoint, passing in the following parameters:


GET https://api.centtrip.com/api/v1/accounts/{accountId}/cards/{cardId}/transactions


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

cardId

6d98ea63-5f85-4ca5-8ae4-a74cd5aec1a6--61ab2ebe-1a0e-49c8-8fc4-2fc7cc2bc0ea


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


401

Unauthorised

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server error

Server error


Load or unload card funds

Follow the steps below to transfer funds account to card, or move funds from a card back to the account.


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account where the card you need to check belongs to from the response:

Step 3: Get card ID

Call the Get cards endpoint passing in the copied ‘id’ as the accountId, then grab the appropriate ‘id’ from the response:

Step 4: Check card balance

REQUEST -

Call the Get card balance endpoint, passing in the following parameters:


GET https://api.centtrip.com/api/v1/accounts/{accountId}/cards/{cardId}/balances


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

cardId

6d98ea63-5f85-4ca5-8ae4-a74cd5aec1a6--61ab2ebe-1a0e-49c8-8fc4-2fc7cc2bc0ea


Step 5: Load or unload card funds

Call the Transfer funds endpoint, passing in the following parameters:


POST https://api.centtrip.com/api/v1/CardTransfers


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

cardId

6d98ea63-5f85-4ca5-8ae4-a74cd5aec1a6--61ab2ebe-1a0e-49c8-8fc4-2fc7cc2bc0ea

currencyCode

GBP

amount

100.75

direction

AccountToCard OR CardToAccount


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


400

Bad Request

One or more passed parameters could not been validated

401

Unauthorised

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server error

Server error


Make payments

Follow the steps below to make a payment to a recipient in your Centtrip account.


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account where the card you need to check belongs to from the response:

Step 3: Check your balance

See the Check account balance playbook for more details.

Step 4: Make a payment

REQUEST -

Call the Create payment with recipient endpoint, passing in the following parameters and using the copied ‘id’ as accountId:

POST https://api.centtrip.com/api/v1/PaymentRecipients


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

currencyCode

GBP

amount

100.25

reason

Payment of invoice ABC

reference

Invoice #12

companyName

Centtrip

address 1

1 Mark Square

city

London

postcode

EC2A 4EG

countryCode

GB


Add the parameters the recipient bank requires to the Request above. It may be bankAccountNumber & bankSortCode or Iban & SwiftBic or accountNumber & ABA.

RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


400

Bad Request

Description

401

Unauthorised

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission


Add a reference to account transactions

Working with Centtrip Transaction data within an accounting or ERP system, it's likely that you will want to apply a status or reference on the transaction, to tag the transaction status in the workflow, to either have additional tasks completed for that transaction or for that transaction to be ignored moving forward e.g. if the expense has completed authorisation and sign-off.


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account with the transactions you wish to add a reference to:

Step 3: Retrieve transactions for a specific period

Call the Get Account Transactions endpoint, passing in the copied ID as accountId. Add the time-frame of the required period using the startDateTime and endDateTime parameters.

Then grab the ‘id’ from the response (it will be referred to as ‘journalRefIds’ in Step 4):

Step 5: Post transaction reference

REQUEST -

Call the Add Account Transaction References endpoint, passing in the following parameters and using the copied ID (see Step 2) as accountId:

POST -
https://api.centtrip.com/api/v1/accounts/{accountId}/transactions/references


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

journalRefIds

fc60f04b-a196-4163-8f43-e035eb9c28c5

reference

MyReference


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


400

Bad Request

One or more passed parameters could not been validated

401

Unauthorized

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server Error

Server Error


Add a reference to card transactions

Working with Centtrip Transaction data within the an accounting or ERP system, it's likely that you will want to apply a status or reference on the transaction to tag that transactions status in the workflow, to either have additional tasks completed for that transaction or for that transaction to be ignored moving forward e.g. if the expense has completed authorisation and sign-off.


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account associated with the card you wish to add a reference to:

Step 3: Get card ID

Call the Get Cards endpoint, passing in the copied ‘id’ as the accountId, then grab the appropriate ‘id’ from the response:

Step 4: Retrieve transactions for a specific period

Call the Get Card Transactions endpoint, passing in the copied IDs as accountId and cardId. Add the time-frame of the required period using the startDateTime and endDateTime parameters.

Then grab the ‘id’ from the response (it will be referred to as ‘journalRefIds’ in Step 5):

Step 5: Post transaction reference

REQUEST -

Call the Create Card Transaction References endpoint, passing in the following parameters and using the copied IDs (see Steps 2 and 3) as accountId and cardId respectively:

POST -
https://api.centtrip.com/api/v1/accounts/{accountId}/cards/{cardId}/transactions/references


Parameter Name:

Example Value:


accountId

5e892ea0-dbf8-4b13-bf18-3f40a94d5149--ecd56cb7-21ff-4a59-9ef0-e21af038c9e1

cardId

6d98ea63-5f85-4ca5-8ae4-a74cd5aec1a6--61ab2ebe-1a0e-49c8-8fc4-2fc7cc2bc0ea

journalRefIds

fc60f04b-a196-4163-8f43-e035eb9c28c5

reference

MyReference


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


401

Unauthorized

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server Error

Server Error


ii. Account Transactions:

REQUEST -

Call the Add Account Transaction References endpoint, passing in the following parameters and using the copied ‘id’ (see Step 2) as accountId:

POST -
https://api.centtrip.com/api/v1/accounts/{accountId}/transactions/references

USING CORPORATE LABELS TO

Map transactions to a Chart of Accounts


How it works -

For spend management reconciliation, it's likely that card transactions will need to be mapped to a specific accounting codes.
You can use Corporate Labels to map these automatically.

Corporate labels are created in groups. Each label within a group consists of two values :

  • a label value (i.e. the label name);
  • an accounting code value

EXAMPLE -

You plan to map transactions to a Xero chart of accounts, and want to map travel expenses to the relevant Chart of Account codes, either: 493 Travel - National or 494 Travel - International.

In this instance, your Corporate Labels would be set up as follows:


GROUP: 'EXPENSES'

Label value

Accounting code value


Label 1 -

'UK Travel'

493

Label 2 -

'International Travel'

494


Corporate Labels can be used to determine a transaction's status in a workflow, for instance indicating if a transaction is ready for reconciliation.


By leveraging Corporate Label Groups, third-party services can determine if a transaction is in a state of readiness to be migrated to the third party system.


For example, the accounting system integration may look for transactions that have a specific set of conditions:

  • Has at least 1 accounting code label
  • Has label = 'Reconcile ready'
  • Has at least 1 attachment

How to get started -

Corporate Label Groups can be created via the Expense Management UI, or programmatically - see Create Corporate Labels and Update Corporate Labels below to get started.

Create Corporate Labels


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account you would like to create corporate labels for.

Step 3: Create label group

Call the Create label groups associated with the account endpoint passing in the following parameters, including the copied ‘id’ as the accountId:

Step 4: Get label groups

To see existing label groups associated with the account, call Get label groups associated with the account endpoint passing in the copied id as accountId.

Step 5: Create corporate label

REQUEST -

Call the Create corporate labels associated with the account endpoint, passing in the following parameters and using the copied ‘id’ as accountId:

POST -
https://api.centtrip.com/api/v1/accounts/{accountId}/corporateLabels


Parameter Name:

Example Value:


corporateLabelGroupCode

519213b4-b07f-46f6-953a-c8ee96252db9

accountingCode

12345

labelName

Food & Beverage


RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


400

Bad Request

One or more passed parameters could not be validated

401

Unauthorized

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server Error

Server Error


Update Corporate Labels


Step 1: Authentication


See
Authenticate & Login for more details.


Step 2: Get account ID


Call the Get accounts endpoint and grab the ‘id’ of the account you need to update a corporate label for.

Step 3: Get corporate labels

Call Get corporate labels associated with the account endpoint, passing in the copied id as accountId and the following parameters:


Parameter Name:

Example Value:


corporateLabelGroupCode

519213b4-b07f-46f6-953a-c8ee96252db9

pageNumber

1

pageSize

10


Step 4: Update corporate labels

REQUEST -

Call the Update corporate label associated with the account endpoint, passing in the following parameters and using the copied ‘id’ as accountId:


PUT

https://api.centtrip.com/api/v1/accounts/{accountId}/corporateLabels

RESPONSE -

In case of success, the response will look like the one below:

ERROR CODES -


HTTP Status

Code

Description


400

Bad Request

One or more passed parameters could not be validated

401

Unauthorized

Your authentication token expired. You should re-authenticate

403

Forbidden

User has no permission

500

Server Error

Server Error