Error response when invoking contact search API | Community
Skip to main content
Answered

Error response when invoking contact search API

  • March 17, 2021
  • 5 replies
  • 528 views

When I invoke the contact search API, I get the following error response.

 

{

"type": "error.list",

"request_id": "0009s379b118psj1f100",

"errors": [

{

"code": "invalid_document",

"message": "either_email_or_user_id_present validation failed"

}

]

}

 

Does anyone know what has gone wrong here?

Best answer by Eric Fitz

Looks like you're sending that POST to https://api.intercom.io/contacts which will try and create a contact.

 

You can send the POST to https://api.intercom.io/contacts/searchto hit the contact search endpoint.

5 replies

Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • March 19, 2021

Hey @rushmin​, could you provide me with an example of an API call that you made which returned this error, please?


  • Author
  • New Participant
  • March 19, 2021

Hi @eric f11​ thank you for the response. I tried various combinations. Below is one of them.

 

curl --location --request POST 'https://api.intercom.io/contacts#39; \

--header 'Accept: application/json' \

--header 'Authorization: Bearer xxxxxxxxxxx' \

--header 'Content-Type: application/json' \

--data-raw '{

"query": {

"operator": "AND",

"value": [

{

"operator": "OR",

"value": [

{

"field": "created_at",

"operator": ">",

"value": 1560436650

},

{

"field": "signed_up_at",

"operator": ">",

"value": 1560436784

}

]

},

{

"operator": "OR",

"value": [

{

"field": "custom_attributes.salseforce_status",

"operator": "~",

"value": "Open"

},

{

"field": "custom_attributes.salesforce_object_type",

"operator": "=",

"value": "Lead"

}

]

}

]

}

}'


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Answer
  • March 23, 2021

Looks like you're sending that POST to https://api.intercom.io/contacts which will try and create a contact.

 

You can send the POST to https://api.intercom.io/contacts/searchto hit the contact search endpoint.


  • Author
  • New Participant
  • March 24, 2021

Thanks a lot, Eric. That was the issue. I have missed the endpoint in the documentation. Sorry for the trouble.


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • March 24, 2021

No trouble at all, @rushmin​! I'm glad we could get this resolved for you 🙌