> ## Documentation Index
> Fetch the complete documentation index at: https://hilos-40.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieving and updating a contact from Hilos

By default the source of truth for contacts in Hilos is HubSpot, however sometimes in your flows you may want to update information gathered from questions or other sources to your contacts in HubSpot, this can be easily done using the API step in your flow, here is how you can do it:

## Prerequisites

To follow along this guide you'll need to get your bearer token from HubSpot. You can find the instructions on how to get it [here](https://developers.hubspot.com/docs/api/private-apps). Remember to correctly set the Read/Write actions depending on wether you want to be able to update that information using the API step from Hilos or not.

## Retrieving your contacts

To retrieve a contact from HubSpot you can make a `GET` request to the `/crm/v3/objects/contacts` HubSpot endpoint. This will return a list of contacts that match the query parameters you provide. You can learn more about this endpoint on the [HubSpot API documentation](https://developers.hubspot.com/docs/api/crm/contacts).

![Get all contacts](https://hilos-media.s3.us-east-2.amazonaws.com/mintlify/using-hilos/integrations/hubspot/updating-contacts/get-contacts.png)

If you wish to retrieve an specific contact you may want to use the `GET` request to `/crm/v3/objects/contacts/{contactId}` endpoint instead.

![Get a specific contact](https://hilos-media.s3.us-east-2.amazonaws.com/mintlify/using-hilos/integrations/hubspot/updating-contacts/get-specific-contact.png)

## Update a contact

To update a contact in HubSpot you can make a `PATCH` request to the `/crm/v3/objects/contacts/{contactId}` HubSpot endpoint. This will update the contact with the provided `contactId` with the information you provide in the request body under the `properties` key. You can learn more about this endpoint on the [HubSpot API documentation](https://developers.hubspot.com/docs/api/crm/contacts).

An example call to update a contact would look like this:

```json theme={null}
{
  "properties": {
    "email": "dan@hilos.io"
  }
}
```

<Tip>
  Remember you can use the results from the API step as a variable for a later
  step in your flow. This allows you to easily update the information according
  to a previous result, however when testing you might need to hardcode the
  `contactId` to make sure the request is successful. Then before publishing
  change the `contactId` to the variable you want to use.
</Tip>

![Update a contact](https://hilos-media.s3.us-east-2.amazonaws.com/mintlify/using-hilos/integrations/hubspot/updating-contacts/patch-contact.png)
