Discussions

Ask a Question
Back to All

Incoming leads: fields missing

Lucas Dantas: Hi! Someone can help-me with the correct payload structure for the endpoint https://{subdomain}.kommo.com/api/v4/leads/unsorted/forms ?

I'm trying to build an wordpress integration with that but I got some "This field is missing." error with 400 status code.

I already have an integration with anotehr endpoint that's working, but my tests on the unsorted/forms aren't working.

my payload:
{
"data": [
{
"source_uid": "teste_from_postman",
"source_name": "Teste ",
"created_at": 1720425600,
"pipeline_id": 9785847,
"metadata": {
"category": "forms",
"form_id": "form_123",
"form_name": "Formulário de Contato",
"form_page": "https://seudominio.com.br/contato",
"ip": "192.168.1.1",
"form_sent_at": 1720425600,
"referer": "https://google.com/"
},
"data": {
"contacts": [
{
"first_name": "João Teste",
"custom_fields_values": [
{
"field_code": "EMAIL",
"values": [
{ "value": "[email protected]" }
]
},
{
"field_code": "PHONE",
"values": [
{ "value": "+5521999999999" }
]
}
]
}
],
"leads": [
{
"name": "Lead de João",
"price": 0,
"pipeline_id": 9785847,
"status_id": 75530159
}
],
"companies": [
{
"name": "Empresa"
}
]
}
}
]
}

error:
{
"validation-errors": [
{
"request_id": "0",
"errors": [
{
"code": "FieldMissing",
"path": "data.source_name",
"detail": "This field is missing."
},
{
"code": "FieldMissing",
"path": "data.source_uid",
"detail": "This field is missing."
},
{
"code": "FieldMissing",
"path": "data.metadata",
"detail": "This field is missing."
},
{
"code": "FieldNotExpected",
"path": "data.0",
"detail": "This field was not expected."
}
]
}
],
"title": "Bad Request",
"type": "https://httpstatus.es/400",
"status": 400,
"detail": "Request validation failed"
}