REST API
The REST API gives you full control for server-to-server integrations and custom frontends. Send the data as JSON and the lead key in the X-API-Key header.
Send a request
const response = await fetch('https://app.advision360.de/api/public/leads', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY',
},
body: JSON.stringify({
firstName: 'Max',
lastName: 'Mustermann',
email: 'max@example.com',
phone: '+49 30 1234567',
source: 'website',
notes: 'Please call back in the morning',
additionalFields: { budget: '5000' },
_meta: { url: 'https://www.example.com/contact' },
}),
})
All fields are described in the API reference.
Handle the response
On success the API responds with 201 Created and an empty JSON object {}. On errors the response contains an error field, validation errors also include violations.
if (response.status === 201) {
showThankYou()
} else if (response.status === 400) {
const { violations } = await response.json()
for (const { field, message } of violations) {
showFieldError(field, message)
}
} else if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After')
console.warn(`Rate limit reached, retry in ${retryAfter} seconds`)
} else {
const { error } = await response.json()
console.error(error)
}
Messages in violations are German or English, depending on the request's Accept-Language header (de or en).
:::info CORS
The API accepts browser requests from any domain. The POST method and the Content-Type and X-API-Key headers are allowed.
:::
Duplicate leads
Whether a request creates a new lead or updates an existing one depends on the Duplicate Detection setting in the lead board's board settings:
- Always create new lead: every request creates a new lead.
- Find and update existing lead: if an existing lead matches by email and/or phone, it is updated with the new data.
The response is 201 Created in both cases.