Skip to content
Gallery
API | Direct Integration Guides
Share
Explore
API | Direct Integration Guides

icon picker
Getting Started - Complyt API

A quick intro for direct integration | Make your first request

Authentication

Request

Use Complyt API to obtain Auth0 bearer token. To do this, you’ll need to send a POST request to complyt token endpoint, passing your client ID and client secret in the request body. Here’s an example cURL command to do this:
curl --request POST \
--url 'https://demo.complyt.io/v1/token' \
--header 'content-type: application/json' \
--data '{
"clientId": "A414......................GsFf87t",
"clientSecret": "HHCv..............gQ491nSVed35"
}'

Response

If the request is successful, you’ll receive a JSON response that includes an access token. The access token is your bearer token, which you can use to authenticate requests to your M2M application’s API. Here’s an example response:
{
"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type":"Bearer",
"expires_in":86400
}
password1
That’s it! You can now use the access token as a bearer token to authenticate requests to your M2M application’s API.
info
Please note that the token expires in 24 so either re-generate it in every request or re-generate it daily

Create Customer

Request

Use the access token obtained from the previous step to make the following request to create a customer in Complyt:
curl -X 'PUT' \
'https://demo.complyt.io/v1/customers/source/1/externalId/999444' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGc...iOiJSUzI1NiIsInR5cCI6IkpXVCJ9...' \
-H 'Content-Type: */*' \
-d '{
"externalId": 999444,
"source": 1,
"name": "Complyt",
"address": {
"city": "Sacramento",
"country": "US",
"county": null,
"state": "CA",
"street": "944 W. Wintergreen St.",
"zip": "95823"
},
"customerType": "RETAIL",
"externalTimestamps": {
"createdDate": "2022-10-19T07:00:00.000Z",
"updatedDate": "2022-10-19T09:07:54.585Z"
}
}'
This API request uses the HTTP PUT method to create a new customer in the Complyt system. The request includes the customer details in the JSON payload of the request body. The -H 'Authorization: Bearer ...' header includes the access token obtained from the previous step, which is used to authenticate the request to the Complyt API.

Required Fields

externalId - The ID of the customer in your system. Note that it needs to be filled in the URL & in the body.
source (integer) - Used to distinguish between multiple systems. Go
to select relevant source number. Needs to be filled in the URL & in the body.
name
country
state - Can be abbreviated state name - CA, or full - California.
street
zip
created_date, updated_date - Supported formats:
yyyy-MM-dd
yyyy-MM-ddThh:mm:ssZ
yyy-MM-ddThh:mm:ss±hh:mm (with a valid time zone offset)

Response

{
"complytId": "dbb5c569-c6b4-4fea-b9ac-1d4f3770f94a", // This is will be used to create transactions under this customer.
"externalId": "999444",
"source": "1",
"name": "Complyt",
"address": {
"city": "Sacramento",
"country": "US",
"county": null,
"state": "CA",
"street": "944 W. Wintergreen St.",
"zip": "95823"
},
"customerType": "RETAIL",
"internalTimestamps": {
"createdDate": {
"timestamp": "2023-02-23T00:53:14.386714464"
},
"updatedDate": {
"timestamp": "2023-02-23T00:53:14.386714464"
}
},
"externalTimestamps": {
"createdDate": {
"timestamp": "2022-10-19T07:00:00"
},
"updatedDate": {
"timestamp": "2022-10-19T09:07:54.585"
}
}
}
contact-card
That’s it! You can now use the complytId from the returned customer object when .

Create Transaction

Request

To create a transaction, take the customerId from the customer you created in the previous request and place it in the ​(We are working on a single request that creates a transactions and a customer, once it’s available all clients will be updated)
curl -X 'PUT' \ 'https://demo.complyt.io/v1/transactions/source/1/externalId/465813' \ -H 'accept: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIs....' \ -H 'Content-Type: _/_' \ -d '{
"externalId": "465813",
"source": "1",
"items": [
{
"unitPrice": 0,
"quantity": 0,
"totalPrice": 0,
"description": "string",
"name": "string",
"taxCode": "C1S1",
"manualSalesTax": false,
"manualSalesTaxRate": 0
}
],
"billingAddress": { // Optional
"city": "",
"country": "US",
"county": null,
"state": "CA",
"street": "3098 N Remington Ave",
"zip": "93711-5508"
},
"shippingAddress": // Required for tax calculation
"city": "frenso",
"country": "US",
"county": null
"state": "CA",
"street": "3098 N Remington Ave",
"zip": "93711-5508"
},
"customerId": "dbb5c569-c6b4-4fea-b9ac-1d4f3770f94a", // Generated from the PUT Customer request
"externalTimestamps": {
"createdDate": "2023-02-05T12:24:43.193Z",
"updatedDate": "2023-02-05T12:24:43.193Z"
},
"transactionStatus": "ACTIVE",
"transactionType": "INVOICE",
"createdFrom": "string"
}

Required Fields

externalId - This is the ID of the transaction in your system.
source (integer) - Used to distinguish between multiple systems. Go
to select relevant source number.
unitPrice
quantity
totalPrice
tax_code - This is a tax code that represents the category of the item. This is used to determine the tax rate.
customerId -
createdDate - the date the transaction was created in your system.
updatedDate - the date the transaction was last updated in your system.
createdFrom - This is a reference to previous transaction. This is used to credit memos, refunds & sales orders
transactionStatus
ACTIVE
CANCELLED - For Cancelled Transaction status please use the DELETE endpoint

Response

receipt
Sales Tax Amount - the bottom line of our calculation, this is what you usually want to add to your invoice 🎯 After adding a transaction to Complyt’s API, you can retrieve the calculated Sales Tax Amount at salesTax.amount
A successful request will result in a 200/201 HTTP response in the following format:
{
"complytId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"externalId": "999444",
"source": "1",
"items": [
{
"unitPrice": 0,
"quantity": 0,
"totalPrice": 0,
"description": "string",
"name": "string",
"taxCode": "string",
"jurisdictionalSalesTaxRules": {
"name": "string",
"abbreviation": "string",
"taxable": true,
"specialTreatment": true,
"calculationType": "FIXED",
"description": "string",
"calculationValue": 0
},
"salesTaxRate": {
"cityDistrictRate": 0,
"cityRate": 0,
"countyDistrictRate": 0,
"countyRate": 0,
"stateRate": 0,
"taxRate": 0
},
"manualSalesTax": true,
"manualSalesTaxRate": 0,
"tangibleCategory": "TANGIBLE",
"taxableCategory": "TAXABLE"
}
],
"billingAddress": {
"city": "string",
"country": "string",
"county": "string",
"state": "string",
"street": "string",
"zip": "string"
},
"shippingAddress": {
"city": "string",
"country": "string",
"county": "string",
"state": "string",
"street": "string",
"zip": "string"
},
"customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"customer": {
"complytId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"externalId": "string",
"source": "7",
"name": "string",
"address": {
"city": "string",
"country": "string",
"county": "string",
"state": "string",
"street": "string",
"zip": "string"
},
"salesTax": {
"amount": 100 //the bottom line of our calculation, this is what you usually want to add to your invoice 🎯
"salesTaxRate": {
"cityDistrictRate": 0,
"cityRate": 0,
"countyDistrictRate": 0,
"countyRate": 0,
"stateRate": 0,
"taxRate": 0
}
},
"transactionStatus": "ACTIVE",
"internalTimestamps": {
"createdDate": {
"timestamp": "2023-02-05T12:24:43.193Z"
},
"updatedDate": {
"timestamp": "2023-02-05T12:24:43.193Z"
}
},
"externalTimestamps": {
"createdDate": {
"timestamp": "2023-02-05T12:24:43.193Z"
},
"updatedDate": {
"timestamp": "2023-02-05T12:24:43.193Z"
}
},
"transactionType": "SALES_ORDER",
"shippingFee": {
"manualSalesTax": true,
"manualSalesTaxRate": 0,
"totalPrice": 0,
"taxCode": "string",
"taxableCategory": "TAXABLE",
"tangibleCategory": "TANGIBLE",
"jurisdictionalSalesTaxRules": {
"name": "string",
"abbreviation": "string",
"taxable": true,
"specialTreatment": true,
"calculationType": "FIXED",
"description": "string",
"calculationValue": 0
},
"salesTaxRate": {
"cityDistrictRate": 0,
"cityRate": 0,
"countyDistrictRate": 0,
"countyRate": 0,
"stateRate": 0,
"taxRate": 0
}
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.