APIs & Integrations

apfanz
Member

Unable to Add Contact to List Using API

I’m trying to use the Hubspot API to add a contact to a list. Here’s the URL:

https://api.hubapi.com/contacts/v1/lists/97/add?hapikey=

Here’s the body of the HTTP POST:

{ “vids”: [3956401]}

I get an HTTP/1.1 200 OK response from the server when I perform this post. I check the list on Hubspot but don’t see the contact added. This is a static list. Does anyone have any ideas? Thanks.

0 Upvotes
6 Replies 6
apfanz
Member

Unable to Add Contact to List Using API

Once I added Content-Type: application/json, I got the following in the body:

{“updated”:[],“discarded”:[3956401],“invalidVids”:[],“invalidEmails”:[]}

It is working now. Thanks.

0 Upvotes
apfanz
Member

Unable to Add Contact to List Using API

@pmanca, I didn’t get any sort of body.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Unable to Add Contact to List Using API

@apfanz When I run it to your portal I get a response of

{
  "updated": [
    3956401
  ],
  "discarded": [],
  "invalidVids": [],
  "invalidEmails": []
}

In your initial post body, are you sending it over as “application/json” ?

0 Upvotes
apfanz
Member

Unable to Add Contact to List Using API

Hello dadams,
Here’s the raw 200 response I got:

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: false
Content-Length: 0
Date: Tue, 27 Dec 2016 21:47:13 GMT
Connection: keep-alive

Our Hubspot ID is 2478981.

Thanks.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Unable to Add Contact to List Using API

@apfanz Did you get any sort of body? I think @dadams is looking for something along these lines

{
  "updated": [
    1
  ],
  "discarded": [],
  "invalidVids": [],
  "invalidEmails": []
}
0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Unable to Add Contact to List Using API

Hi @apfanz

Did you happen to record the body of that 200 response? It’s possible that the vid was invalid or discarded, which would have been indicated in the response. Otherwise, if the vid was listed as updated and you’re still not seeing the contact in the list, can you send me your Hub ID so I can take a look at this?

0 Upvotes