Nizar2
March 17, 2025, 12:59am
1
Hi everyone!
So, I have a custom record with 4 properties. I want to create a new record of this object.
i do POST to api.hubapi.com/crm/v4/objects/2-41795069
the body is as follow:
{
“properties”:
[
{
“name”: “external_id”,
“color”: “EQ”,
“size”: “X1010”
}
]
}
The API returns a list of records rather than creating a new one.
I dont know what I am doing wrong here.
Hi @Nizar2 ,
Your JSON request body structure is incorrect. When creating custom objects, HubSpot’s API requires a key-value pair object, not an array, for the properties field.
Here’s how your request should be formatted:
{
"properties": {
"external_id": "your_value_here",
"color": "EQ",
"size": "X1010"
}
}
Nizar2
March 17, 2025, 6:05am
3
Hey @GiantFocal ,
Thanks for your reply!
Unfortunately, that what I was trying for the past couple of days with no success. No errors. The response is always the list of the records.
{
“properties”: {
“color”: “EQ”,
“size”: “X1010”,
“name”: “Nizar”
}
}
Could be I am using the wrong URL? Or Method?
api.hubapi.com/crm/v4/objects/2-41795069 ?
Your help is highly appreciated.
@Nizar2 - I see you are attempting to call a v4 API. The only version I see documented for this POST call is V3: https://api.hubapi.com/crm/v3/objects/{objectType}
Could that be an issue?
Steve
Nizar2
March 17, 2025, 6:25pm
5
Hey Steve!
Thanks for your reply!
I get the same result with v3.
Please try writing out the entire url with the https in front (whichever API version works for you):
https://api.hubapi.com/crm/v4/objects/2-41795069
https://api.hubapi.com/crm/v3/objects/2-41795069
I’m guessing that Postman is posting to the http URL and in your Postman settings, you do NOT have the option enabled to “Follow original HTTP method” to continue using POST when it gets redirected to the https url.
So when it does get redirected from http → https, it switches to GET which is why you’re always getting the results.
Nizar2
March 19, 2025, 1:36am
7
Somehow I overlooked your respone. Adding the HTTPS at the begginning fixed it. You’re the best!