How do I send data to a custom field when creating a new person via API

yoplepipe
yoplepipe Member Posts: 1 VERIFIED MEMBER

I am adding persons from my backend to pipedrive using API, I'd like to understand how can I send data to custom fields I defined in the company setting

Tagged:

Answers

  • Amit Sarda (AmitSarda.xyz)
    Amit Sarda (AmitSarda.xyz) Member Posts: 1,610 VERIFIED MEMBER
    1000 Comments 250 Likes Fourth Anniversary 25 Answers

    Should be doable with another API call? I know that Make/Integromat allows access to the custom fields when updating objects, so it should work with an additional API call.

  • oneguyteam
    oneguyteam Member Posts: 2 VERIFIED MEMBER
    First Comment
    edited March 2023 #3

    Assuming you know the custom field's id/key, you can simply add it to the request body, e.g.

    {
    # ...
    "name": "Jonh Doe"
    # Custom field
    "aaaaabbbbbcccccdddddeeeeeffffff000000111111": 110
    }
    
    

    And if you don't know the id you can either copy it from the UI in /settings/fields using "Copy API Key", or get it via API with GET /personFields

  • oneguyteam
    oneguyteam Member Posts: 2 VERIFIED MEMBER
    First Comment

    Assuming you already know the custom field's key, you can simply use it in the request body in POST or PUT, e.g.

    {
    # Normal fields
    "name": "John Doe",
    # ...
    # Custom field
    "aaaaabbbbbcccccdddddeeeeefffff0000011111": "Some value"
    }
    

    If you don't know the field's key you can get it in the admin UI by visiting Data Fields (/settings/fields) and using the "Copy API Key" action in the field's row.

    Alternatively you can get it via API by calling GET /personFields