POST new contact

Hi guys,

I need help here.
I’m using this code to add a new contact in HUbspot

headers = {
 'Authorization': f'Bearer {token}',
 'Content-Type': 'application/json'
}

url = f'https://api.hubapi.com/contacts/v1/contact/'

# Dados do contato a serem inseridos
contact_data = {
 "properties": [
 {
 "property": "email",
 "value": "testingapis@hubspot.com"
 },
 {
 "property": "firstname",
 "value": "Adrian"
 },
 {
 "property": "lastname",
 "value": "Mott"
 },
 {
 "property": "segmento",
 "value": "Industria e Comercio"
 },
 {
 "property": "company",
 "value": "HubSpot"
 },
 {
 "property": "phone",
 "value": "555-122-2323"
 },
 {
 "property": "cargo_dropdown",
 "value": "CEO/Sócio/Proprietário"
 },
 {
 "property": "annualrevenue",
 "value": "Menor que 4,8 milhões"
 },
 ]
}

# Realiza a solicitação POST para criar o contato
response = requests.post(url, json=contact_data, headers=headers)

And is working, except for the property: annualrevenue
the value for her is empty in Hubspot contact page, but the others informations are ok.

can someone help me?

Hi @RCarvalho,
Thank you for asking the Community!
I understand that you’d like to create a new contact via API and add a value to the “Annual revenue” contact property at the same time but this property “annual revenue” is not updating.
1. What is the response when making this API call, please?
2. If you try to create a contact and add this same value vie the HubSpot interface (instead of the API), does this work?
3. If you go to the HubSpot interface, after making the API call, and you look at the details of this property, is there any information?
You should be able to update this contact property from what I can see.
I also wanted to invite a couple of subject matter experts to this conversation: Hi @Teun, @zach_threadint and @ChrisoKlepke do you have suggestions to help @RCarvalho, please?
Also, if anybody else has anything to add and/or share, please feel free to join in the conversation :slightly_smiling_face:
Thank you so much and have a wonderful day!
Best,
Bérangère

Hi @RCarvalho :waving_hand:

I’ve not been able to replicate the issue you’re experiencing. The only thing I can think of is to try your request again, but this time without the trailing comma after the annualrevenue property assignment.

headers = {
 'Authorization': f'Bearer {token}',
 'Content-Type': 'application/json'
}

url = f'https://api.hubapi.com/contacts/v1/contact/'

# Dados do contato a serem inseridos
contact_data = {
 "properties": [
 {
 "property": "email",
 "value": "testingapis@hubspot.com"
 },
 {
 "property": "firstname",
 "value": "Adrian"
 },
 {
 "property": "lastname",
 "value": "Mott"
 },
 {
 "property": "segmento",
 "value": "Industria e Comercio"
 },
 {
 "property": "company",
 "value": "HubSpot"
 },
 {
 "property": "phone",
 "value": "555-122-2323"
 },
 {
 "property": "cargo_dropdown",
 "value": "CEO/Sócio/Proprietário"
 },
 {
 "property": "annualrevenue",
 "value": "Menor que 4,8 milhões"
 }
 ]
}

# Realiza a solicitação POST para criar o contato
response = requests.post(url, json=contact_data, headers=headers)

I hope this proves helpful. Please let me know if you have any follow-up questions.