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

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:

KeyValue
Content-Typeapplication/json
X-API-KeyYOUR_API_KEY

API endpoints


Environments

EnvironmentBase URL
QAhttps://qa-api.cap-gateway.com
Productionhttps://api.cap-gateway.com

Operations

MethodEndpointDescription
POST/lead-submission/v1/externalThis 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/external

Example 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

PropertyTypeRequiredSupplied by CAPDescription
metadataobjectYesNoInformation about the campaign and enquiry details.
metadata.campaignIdguidYesYesUnique ID of the marketing campaign.
metadata.enquiryDateTimedatetimeYesNoDate 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.externalReferenceIdstringNoNoExternal system reference ID for tracking. Client's reference ID.
metadata.enquiryTypestringYesYesType of enquiry. Accepted Values: “Test Drive”, “Quotation”, “Retailer Contact”, “KMI”, “Interest Only”, “Register Of Interest”.
metadata.ipAddressstringNoNoThe IP address of the user.
metadata.enquirySource.sourcestringYesYesThe source for the enquiry.
contactDetailobjectYesNoContains the contact details of the person submitting the enquiry.
contactDetail.firstNamestringYesNoFirst name of the individual.
contactDetail.lastNamestringYesNoLast name of the individual.
contactDetail.emailAddressstringYesNoEmail address of the individual.
contactDetail.phoneNumberstringConditionalNoPhone number of the individual. +44 or 0 prefix accepted.Required for certain campaigns.
contactDetail.address.postcodestringConditionalNoPostcode of the individual's address. Required for certain campaigns.
optInConsentsobjectYesNoContains consent data for different communication channels.
optInConsents.phoneCallbooleanNoNoOpt-in status for the communication channel. Accepted values: true, false, null.
optInConsents.postbooleanNoNoOpt-in status for the communication channel. Accepted values: true, false, null.
optInConsents.emailbooleanNoNoOpt-in status for the communication channel. Accepted values: true, false, null.
optInConsents.smsbooleanNoNoOpt-in status for the communication channel. Accepted values: true, false, null.
vehicle.namestringYesYesName of the vehicle the user is interested in.

Example responses

Error handling


Response codes

CodeDescription
202Lead submission accepted
400Bad request, validation error
401Unauthorized, invalid token
500Internal server error

Error messages

Each error message points out a specific issue related to the submission. This could be the submission data, campaign configurations, or other entities like vehicles, and offers a general suggestion to either correct the submission or contact support.

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."

PropertyError message
metadataMetadata must not be empty.
metadata.enquiryDateTimeEnquiryDateTime must not be empty.
metadata.enquiryTypeEnquiryType must not be empty.
metadata.enquirySourceEnquirySource must not be empty.
metadata.enquirySource.sourceSource must not be empty.
vehicleVehicle must not be empty.
vehicle.nameVehicle Name must not be empty.
contactDetailContactDetail must not be empty.
contactDetail.firstNameFirstName must not be empty.
contactDetail.lastNameLastName must not be empty.
contactDetail.emailAddressEmailAddress must not be empty.
contactDetail.phoneNumberPhoneNumber must not be empty.
contactDetail.addressAddress must be empty.
contactDetail.addressAddress must not be empty.
contactDetail.address.postcodePostcode must not be empty.
contactDetail.address.postcodePostcode is not in a valid format.
optInConsentsOpt In Consents must not be empty.

Setup and campaign messages

Error typeError messageDescription
InternalErrorThere has been an issue processing your request. Please contact support.General error indicating an issue with internally. User should contact support for further assistance.
InvalidCampaignIdCampaignId 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.
CampaignNotFoundCampaign 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.
CampaignNotStartedCampaign 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.
CampaignHasEndedCampaign 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.
CampaignNotActiveCampaign is not currently active. Submissions are not currently being accepted.The campaign is not currently active. Please contact support if this is not expected.
VehicleNotFoundVehicle '{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.campaignId
vehicle.name
User should contact support for further assistance.
InvalidCampaignParametersPlease 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.campaignId
metadata.enquiryType
metadata.enquirySource.source
vehicle.name
User should contact support for further assistance.
SourceNotFoundSource '{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.