Skip to main content

Post Direct Transaction Reference

Endpoint​

POST /direct-transaction

What this endpoint does​

Submit an invoice (INV) or credit note (CDT) for a Capricorn member using the invoice date. Capricorn validates the transaction against applicable business rules before accepting it for processing. If the transaction fails validation, the response identifies the business rules that were not satisfied so the transaction can be corrected and resubmitted.

important

A 202 Accepted response confirms that the transaction submission has been accepted for processing.

Request Headers​

In the tables below, Required indicates the established supplier-facing guidance for making the request.

HeaderTypeRequiredDescriptionConstraintsExample
client_idstringYesClient credential that identifies the calling application.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$0123456789ABCDEF0123456789ABCDEF
client_secretstringYesClient credential secret for the calling application.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ABCDEF0123456789ABCDEF0123456789
x-captokenstringYesCapricorn authorization token for the approved request context.64-character hexadecimal SHA-256 hashYOUR_CAP_TOKEN
X-Correlation-IDstringNoOptional correlation value used for tracing and support.Pattern ^[0-9a-zA-Z(\-){}]+$, min length 1a0235ed0-d884-11ef-957a-005056afc7ce

URI / Query Parameters​

This endpoint does not define any URI parameters or query parameters. All transaction details are supplied in the request body.

Request Body​

Requests to this endpoint must use Content-Type: application/json.

{
"transactionAmount": 1500.95,
"invoiceDate": "2025-09-23",
"memberId": "111555",
"supplierId": "000000",
"invoiceNumber": "INV-1234567_ABC",
"sourceTransactionReference": "0000-0000000110272817_ABC",
"transactionType": "INV",
"lineItems": [
{
"id": "ABCD-123456",
"name": "ABCD 4X4 Battery",
"code": "SKU: A5439787",
"description": "ABCD 4x4 and SUV Battery",
"unitPrice": 209.59,
"quantity": 10,
"tax": 100.01,
"totalAmount": 2195.91
}
]
}
important

If a Member ID contains fewer than six digits, include leading zeros when constructing the request. Examples: 001234, 000321, 088776, 000077

important

invoiceDate must be provided in YYYY-MM-DD format. Example: 2025-09-23.

FieldTypeRequiredDescriptionConstraints / Example
transactionAmountnumberYesTransaction total amount.Up to 2 decimal places; 1500.95
invoiceDatestring (date-only)YesInvoice date of the transaction.yyyy-MM-dd; 2025-09-23
memberIdstringYesSix-digit numeric Capricorn member identifier.111555
supplierIdstringYesSix-digit numeric Capricorn supplier identifier.000000
invoiceNumberstringYesSupplier invoice number.Pattern ^[a-zA-Z0-9_.\/-]+$; maximum length 37; INV-1234567_ABC
sourceTransactionReferencestringYesUnique identifier at the supplier side, used for duplicate prevention and response correlation.Pattern ^[a-zA-Z0-9_.\/-]+$; maximum length 40; 0000-0000000110272817_ABC
transactionTypestringYesTransaction type.INV (Invoice) or CDT (Credit Note)
lineItemsarray of objectsNoOptional line-item breakdown of the transaction.See nested fields below.
lineItems[].idstringNoLine item identifier.Length 1-50; ABCD-123456
lineItems[].namestringNoLine item name.Length 1-100
lineItems[].codestringYesLine item code.Length 1-100; SKU: A5439787
lineItems[].descriptionstringYesLine item description.Length 1-255
lineItems[].unitPricenumberNoUnit price.Up to 2 decimal places; 209.59
lineItems[].quantitynumberNoQuantity.Up to 2 decimal places; 10
lineItems[].taxnumberNoTax amount.Up to 2 decimal places; 100.01
lineItems[].totalAmountnumberYesTotal amount of the line item.Up to 2 decimal places; 2195.91

Code Examples​

important

Replace the example credentials with the values provided during onboarding. If the example includes a supplierId, use your own supplier ID associated with your x-captoken.

curl -X POST 'https://api.capricorn.example.com/direct-transaction' \
-H 'Content-Type: application/json' \
-H 'client_id: YOUR_CLIENT_ID' \
-H 'client_secret: YOUR_CLIENT_SECRET' \
-H 'x-captoken: YOUR_CAP_TOKEN' \
-H 'source: CapLink' \
-d '{
"transactionAmount": 1500.95,
"invoiceDate": "2025-09-23",
"memberId": "111555",
"supplierId": "000000",
"invoiceNumber": "INV-1234567_ABC",
"sourceTransactionReference": "0000-0000000110272817_ABC",
"transactionType": "INV",
"lineItems": [
{
"id": "ABCD-123456",
"name": "ABCD 4X4 Battery",
"code": "SKU: A5439787",
"description": "ABCD 4x4 and SUV Battery",
"unitPrice": 209.59,
"quantity": 10,
"tax": 100.01,
"totalAmount": 2195.91
}
]
}'

Responses​

important

X-Correlation-ID is generated automatically if omitted and may appear as correlationId in the response body.

202 Accepted​

The request has been accepted for processing.

Response headers

HeaderTypeRequiredDescriptionConstraintsExample
X-Correlation-IDstringNoThis is a unique ID passed in by the Consumer or returned as part of the response to correlate the HTTP Request and HTTP Response.Pattern ^[0-9a-zA-Z(\-){}]+$; minimum characters: 1a0235ed0-d884-11ef-957a-005056afc7ce

Response Body

FieldTypeRequiredDescription / Example
sourceTransactionReferencestringNoSupplier-side transaction reference. Example: srcTranxRef1234
correlationIdstringNoCorrelation identifier for the request. Example: a0235ed0-d884-11ef-957a-005056afc7ce
messagestringYesAcknowledgement that the request has been accepted. Example: The request has been accepted for processing.
statusstringNoAcceptance status. Example: Success
{
"sourceTransactionReference": "srcTranxRef1234",
"correlationId": "a0235ed0-d884-11ef-957a-005056afc7ce",
"message": "The request has been accepted for processing.",
"status": "Success"
}

400 Bad Request​

The request could not be processed as submitted.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side reference for the transaction.00000400011101-12743
error.typestringError category for request-shape or validation problems.CAP:BAD_REQUEST
error.descriptionstringShort summary of the failure category.Bad request
error.messagestringMessage describing what to correct before retrying.Invalid Request, Please validate the request message.
{
"sourceTransactionReference": "00000400011101-12743",
"error": {
"type": "CAP:BAD_REQUEST",
"description": "Bad request",
"message": "Invalid Request, Please validate the request message."
}
}

401 Unauthorized​

Returned when an invalid token is provided.

FieldTypeDescriptionExample
sourceTransactionReferencestring or nullSupplier-side reference for the transaction, if available.null
correlationIdstringCorrelation identifier for the request.1e9a2980-e240-11f1-a8a2-00155d147f19
error.typestringError category returned when authentication fails.CAP:UNAUTHORIZED
error.descriptionstringShort summary of the authentication failure.Unauthorized
error.messagestringExplains that the supplied token was rejected.Invalid token provided
{
"sourceTransactionReference": null,
"correlationId": "1e9a2980-e240-11f1-a8a2-00155d147f19",
"error": {
"type": "CAP:UNAUTHORIZED",
"description": "Unauthorized",
"message": "Invalid token provided"
}
}

409 Conflict​

The supplied trait identifies a duplicate transaction request.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side reference for the transaction.srcTranxRef12346
correlationIdstringCorrelation identifier for the request.9ea389c0-e243-11f1-a8a2-00155d147f19
error.typestringError category for duplicate submissions.CAP:CONFLICT
error.descriptionstringShort summary of the duplicate condition.Conflict
error.messagestringExplains that the transaction reference has already been submitted.Unable to process the contained instructions. Error due to Duplicate transaction request. Please check the transaction, for already submitted request.
{
"sourceTransactionReference": "srcTranxRef12346",
"correlationId": "9ea389c0-e243-11f1-a8a2-00155d147f19",
"error": {
"type": "CAP:CONFLICT",
"description": "Conflict",
"message": "Unable to process the contained instructions. Error due to Duplicate transaction request. Please check the transaction, for already submitted request."
}
}

422 Unprocessable Entity​

The Direct Transaction trait describes a business-rules failure using the following error envelope.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side transaction reference.srcTranxRef12345678
correlationIdstringCorrelation identifier for the request.00783be0-e240-11f1-a8a2-00155d147f19
error.typestringError category for the business-rule failure.CAP:BUSINESS_RULE_FAILURE
error.descriptionstringSummary of the validation failure.Business Rule(s) validation failed
error.messagestringExplains that business-rule validation failed.Transaction cannot be processed due to one or multiple business rule failure(s).
{
"sourceTransactionReference": "srcTranxRef12345678",
"correlationId": "00783be0-e240-11f1-a8a2-00155d147f19",
"error": {
"type": "CAP:BUSINESS_RULE_FAILURE",
"description": "Business Rule(s) validation failed",
"message": "Transaction cannot be processed due to one or multiple business rule failure(s)."
}
}

429 Too Many Requests​

Returned when the caller exceeds the API rate limit.

FieldTypeDescriptionExample
messagestringRate-limit message returned when too many requests are sent in a short period.Too Many Requests
{
"message": "Too Many Requests"
}

500 Internal Server Error​

The API encountered an unexpected server-side error.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side transaction reference.00000400011101-12743
error.typestringError category for the server-side failure.CAP:INTERNAL_SERVER_ERROR
error.descriptionstringSummary of the failure.Internal server error
error.messagestringAdvises retrying later.API encountered an unexpected error. Please retry later.
{
"sourceTransactionReference": "00000400011101-12743",
"error": {
"type": "CAP:INTERNAL_SERVER_ERROR",
"description": "Internal server error",
"message": "API encountered an unexpected error. Please retry later."
}
}

503 Service Unavailable​

The supplied trait describes a timeout connecting to a backend API or system.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side reference for the transaction.00000400011101-12743
error.typestringError category for temporary downstream or platform outages.CAP:SERVICE_UNAVAILABLE
error.descriptionstringShort summary of the availability issue.Service unavailable
error.messagestringIndicates a timeout connecting to a backend API or system.A Connection Timeout Error was encountered connecting to a backend API or System.
{
"sourceTransactionReference": "00000400011101-12743",
"error": {
"type": "CAP:SERVICE_UNAVAILABLE",
"description": "Service unavailable",
"message": "A Connection Timeout Error was encountered connecting to a backend API or System."
}
}