Unable to Add Contact to List Using API

contacts

#1

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.


#2

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?


#3

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.


#4

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

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

#5

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


#6

@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” ?


#7

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

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

It is working now. Thanks.