Getting started
This documentation provides the necessary steps to authenticate with the CAP API, submit leads to the CAP Platform, and handle responses effectively. It includes detailed descriptions of the Authentication, payload structure, and example responses for both successful and non-successful scenarios.
Prerequisites
Before you can start your integration, you will require the following details from CAP:
- API key and campaign ID, per environment
- Source acquisition channel
- Enquiry type
- Vehicle names
- Additional required fields for campaign
Authentication
API key
This API requires authentication using a static API key to access its endpoints. Your API key should be provided to you from CAP. Example API key: be12f0d522bb41968b7cf4f82c76fbc2.
The following headers are required to submit a lead:
| Key | Value |
|---|---|
| Content-Type | application/json |
| X-API-Key | YOUR_API_KEY |
API endpoints
Environments
| Environment | Base URL |
|---|---|
| QA | https://qa-api.cap-gateway.com |
| Production | https://api.cap-gateway.com |
Operations
| Method | Endpoint | Description |
|---|---|---|
POST | /lead-submission/v1/external | This endpoint allows the submission of leads including contact details, opt-in consents, and vehicle. |
Lead submission
This endpoint allows external systems to submit leads, capturing essential details such as contact details, vehicle selected, and opt-in consents.
Request URL
[POST]
{baseUrl}/lead-submission/v1/externalExample request
Example request body
{
"metadata": {
"campaignId": "966c7488-bfa7-45b5-8510-d26ba3008879",
"enquiryDateTime": "2024-09-12T10:20:59.52",
"externalReferenceId": "9cf5ae87-aafb-43e5-b4d3-9d72367a2b86",
"enquiryType": "Test Drive",
"ipAddress": null,
"enquirySource": {
"source": "Google"
}
},
"contactDetail": {
"firstName": "test",
"lastName": "test",
"emailAddress": "[email protected]",
"phoneNumber": "+4420 8759 9036",
"address": {
"postcode": "L39AG"
}
},
"optInConsents": {
"phoneCall": true,
"post": false,
"email": false,
"sms": false
},
"vehicle": {
"name": "Audi Q6 e-tron"
}
}Payload description
| Property | Type | Required | Supplied by CAP | Description |
|---|---|---|---|---|
metadata | object | Yes | No | Information about the campaign and enquiry details. |
metadata.campaignId | guid | Yes | Yes | Unique ID of the marketing campaign. |
metadata.enquiryDateTime | datetime | Yes | No | Date and time the enquiry was made. ISO 8601 format, Coordinated Universal Time (UTC), to the second. 'T' is a delimiter between the date and time. |
metadata.externalReferenceId | string | No | No | External system reference ID for tracking. Client's reference ID. |
metadata.enquiryType | string | Yes | Yes | Type of enquiry. Accepted Values: “Test Drive”, “Quotation”, “Retailer Contact”, “KMI”, “Interest Only”, “Register Of Interest”. |
metadata.ipAddress | string | No | No | The IP address of the user. |
metadata.enquirySource.source | string | Yes | Yes | The source for the enquiry. |
contactDetail | object | Yes | No | Contains the contact details of the person submitting the enquiry. |
contactDetail.firstName | string | Yes | No | First name of the individual. |
contactDetail.lastName | string | Yes | No | Last name of the individual. |
contactDetail.emailAddress | string | Yes | No | Email address of the individual. |
contactDetail.phoneNumber | string | Conditional | No | Phone number of the individual. +44 or 0 prefix accepted.Required for certain campaigns. |
contactDetail.address.postcode | string | Conditional | No | Postcode of the individual's address. Required for certain campaigns. |
optInConsents | object | Yes | No | Contains consent data for different communication channels. |
optInConsents.phoneCall | boolean | No | No | Opt-in status for the communication channel. Accepted values: true, false, null. |
optInConsents.post | boolean | No | No | Opt-in status for the communication channel. Accepted values: true, false, null. |
optInConsents.email | boolean | No | No | Opt-in status for the communication channel. Accepted values: true, false, null. |
optInConsents.sms | boolean | No | No | Opt-in status for the communication channel. Accepted values: true, false, null. |
vehicle.name | string | Yes | Yes | Name of the vehicle the user is interested in. |
Example responses
Error handling
Response codes
| Code | Description |
|---|---|
202 | Lead submission accepted |
400 | Bad request, validation error |
401 | Unauthorized, invalid token |
500 | Internal server error |
Error messages
Validation messages
Validation messages will be present in the response in this format: “Property:{PropertyName}; ErrorMessage:{Message}“. See below for the list of messages.
E.g. "Property:ContactDetail.FirstName; ErrorMessage:'First Name' must not be empty."
| Property | Error message |
|---|---|
metadata | Metadata must not be empty. |
metadata.enquiryDateTime | EnquiryDateTime must not be empty. |
metadata.enquiryType | EnquiryType must not be empty. |
metadata.enquirySource | EnquirySource must not be empty. |
metadata.enquirySource.source | Source must not be empty. |
vehicle | Vehicle must not be empty. |
vehicle.name | Vehicle Name must not be empty. |
contactDetail | ContactDetail must not be empty. |
contactDetail.firstName | FirstName must not be empty. |
contactDetail.lastName | LastName must not be empty. |
contactDetail.emailAddress | EmailAddress must not be empty. |
contactDetail.phoneNumber | PhoneNumber must not be empty. |
contactDetail.address | Address must be empty. |
contactDetail.address | Address must not be empty. |
contactDetail.address.postcode | Postcode must not be empty. |
contactDetail.address.postcode | Postcode is not in a valid format. |
optInConsents | Opt In Consents must not be empty. |
Setup and campaign messages
| Error type | Error message | Description |
|---|---|---|
InternalError | There has been an issue processing your request. Please contact support. | General error indicating an issue with internally. User should contact support for further assistance. |
InvalidCampaignId | CampaignId is not valid. Please check that it is populated and with the correct value. | The specified Campaign ID is invalid or missing on the fieldmetadata.campaignId. |
CampaignNotFound | Campaign not found. If the correct CampaignId has been verified and the issue persists, please contact support. | The system could not find a campaign matching the provided Campaign ID. Verify the value in metadata.campaignId or contact support. |
CampaignNotStarted | Campaign has not started. Submissions are not yet being accepted. | The campaign has not started, so leads are not yet being accepted. Contact support if this is not expected. |
CampaignHasEnded | Campaign has ended. Submissions are no longer being accepted. | The campaign has ended, and will not accept any more leads. Contact support if this is not expected. |
CampaignNotActive | Campaign is not currently active. Submissions are not currently being accepted. | The campaign is not currently active. Please contact support if this is not expected. |
VehicleNotFound | Vehicle '{VEHICLE_NAME}' was not found for the campaign '{CAMPAIGN_ID}'. | The specified vehicle could not be found for the given campaign. Verify the combination of the field values: metadata.campaignIdvehicle.nameUser should contact support for further assistance. |
InvalidCampaignParameters | Please check correct combination of CampaignId, Source, EnquiryType and Vehicle have been specified or contact support. | Could be due to an incorrect combination of the data on the fields:metadata.campaignIdmetadata.enquiryTypemetadata.enquirySource.sourcevehicle.nameUser should contact support for further assistance. |
SourceNotFound | Source '{CHANNEL}' not found. Please check correct value has been specified or contact support. | The specified Source is invalid. Please verify the value specified in metadata.enquirySource.source or contact support. |