This endpoint allows creating a new contract. If needed, it also permits the creation of a new customer and a new payment account or the provision of existing customer and payment account IDs to sync the new contract with them.
curl --request POST \
--url https://api.useaira.com/v1/contracts/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '{
"customer": {
"externalId": "cust_1234567890abcdef",
"name": "Acme Inc.",
"customFields": {
"custom_field_1": "value1",
"custom_field_2": "value2"
}
},
"paymentAccount": {
"businessName": "<string>",
"tradeName": "<string>",
"taxId": "<string>",
"email": "jsmith@example.com",
"address": {
"zipCode": "<string>",
"number": "<string>",
"street": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "AC",
"country": "Brasil",
"complement": "<string>"
}
},
"customerId": "<string>",
"paymentAccountId": "<string>",
"contract": {
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"billingEndDay": 16,
"planIds": [
"<string>"
],
"paymentSettings": {
"scheduledPaymentDay": 16,
"dueOffsetDays": 6
},
"billingSettings": {
"billingCycleMinimumAmount": 1
},
"customFields": {}
}
}'
{
"contract": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"billingEndDay": 16,
"status": "active",
"plans": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>"
}
],
"paymentSettings": {
"scheduledPaymentDay": 16,
"dueOffsetDays": 6
},
"billingSettings": {
"billingCycleMinimumAmount": 1
},
"customFields": {}
},
"customer": {
"id": "<string>",
"externalId": "cust_1234567890abcdef",
"name": "Acme Inc.",
"customFields": {
"custom_field_1": "value1",
"custom_field_2": "value2"
}
},
"paymentAccount": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"businessName": "<string>",
"tradeName": "<string>",
"taxId": "<string>",
"email": "jsmith@example.com",
"address": {
"zipCode": "<string>",
"number": "<string>",
"street": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "AC",
"country": "Brasil",
"complement": "<string>"
}
}
}
API Key Authentication.
Provide a new customer and a new payment account to create a new contract for the new customer and payment account.
The request was successfully processed, and the contract has been created. As well as new customer and/or a new payment account if they were part of the request.
curl --request POST \
--url https://api.useaira.com/v1/contracts/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '{
"customer": {
"externalId": "cust_1234567890abcdef",
"name": "Acme Inc.",
"customFields": {
"custom_field_1": "value1",
"custom_field_2": "value2"
}
},
"paymentAccount": {
"businessName": "<string>",
"tradeName": "<string>",
"taxId": "<string>",
"email": "jsmith@example.com",
"address": {
"zipCode": "<string>",
"number": "<string>",
"street": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "AC",
"country": "Brasil",
"complement": "<string>"
}
},
"customerId": "<string>",
"paymentAccountId": "<string>",
"contract": {
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"billingEndDay": 16,
"planIds": [
"<string>"
],
"paymentSettings": {
"scheduledPaymentDay": 16,
"dueOffsetDays": 6
},
"billingSettings": {
"billingCycleMinimumAmount": 1
},
"customFields": {}
}
}'
{
"contract": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"billingEndDay": 16,
"status": "active",
"plans": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>"
}
],
"paymentSettings": {
"scheduledPaymentDay": 16,
"dueOffsetDays": 6
},
"billingSettings": {
"billingCycleMinimumAmount": 1
},
"customFields": {}
},
"customer": {
"id": "<string>",
"externalId": "cust_1234567890abcdef",
"name": "Acme Inc.",
"customFields": {
"custom_field_1": "value1",
"custom_field_2": "value2"
}
},
"paymentAccount": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"businessName": "<string>",
"tradeName": "<string>",
"taxId": "<string>",
"email": "jsmith@example.com",
"address": {
"zipCode": "<string>",
"number": "<string>",
"street": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "AC",
"country": "Brasil",
"complement": "<string>"
}
}
}