> For the complete documentation index, see [llms.txt](https://docs.spara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spara.com/build/workflows/steps/crm-api.md).

# CRM API Step

Call your connected CRM's API with Spara's stored connection and extract data from the response.

The **CRM API** step makes an authenticated request to your connected CRM — **Salesforce**, **HubSpot**, or **Marketo** — and optionally extracts data from the response into lead fields for use in downstream steps.

It works like the [API Step](/build/workflows/steps/api.md) step, but you don't manage credentials or build the full URL. Spara uses the CRM connection you already set up under **Settings → Integrations**, refreshes the access token when it expires, and prepends the CRM's base URL to the endpoint you enter.

{% hint style="info" %}
Only organization admins can add a CRM API step to a workflow.
{% endhint %}

## Configuration

### CRM

Choose the CRM to call. Only CRMs your organization has connected are selectable; a CRM that needs to be reconnected is flagged, and the step won't run until it is reconnected in **Settings → Integrations**.

### Method and endpoint

Select the HTTP method (**GET**, **POST**, **PUT**, or **PATCH**) and enter the endpoint **path**. Spara prepends the CRM's base URL:

| CRM        | Base URL                                                              |
| ---------- | --------------------------------------------------------------------- |
| Salesforce | Your Salesforce instance URL (e.g., `https://acme.my.salesforce.com`) |
| HubSpot    | `https://api.hubapi.com`                                              |
| Marketo    | Your Marketo REST host (e.g., `https://123-ABC-456.mktorest.com`)     |

The endpoint supports variables, so you can address a specific record using lead data. For example:

```
/crm/v3/objects/contacts/{{ hubspot_contact_id }}
```

The endpoint must be a path relative to the CRM's base URL — a full URL or a path that navigates above the base is rejected.

### Headers

Add request headers as key/value pairs. Spara sets the `Authorization` header from your CRM connection, so you never enter a token here.

### Body

For **POST**, **PUT**, and **PATCH** requests, enter the request body as JSON. The editor provides syntax highlighting, inline validation, a **Format** button, and the **Insert menu** (⚡) for variables — the same as the API step.

```json
{
  "properties": {
    "lifecyclestage": "salesqualifiedlead",
    "spara_intent_score": "{{ intent_score }}"
  }
}
```

### Field Extraction

After the request completes, Spara can extract values from the response and save them as lead fields, available as variables in downstream steps.

| Field           | Description                                                                  |
| --------------- | ---------------------------------------------------------------------------- |
| **Name**        | The field name (e.g., `owner_email`). Use snake\_case.                       |
| **Description** | Tell the AI what this field represents and where to find it in the response. |

## Example: Look up a HubSpot contact's owner

```
CRM: HubSpot
GET /crm/v3/objects/contacts/{{ hubspot_contact_id }}?properties=hubspot_owner_id,lifecyclestage

Field Extraction:
- Name: hubspot_owner_id
  Description: The contact's owner ID from "properties.hubspot_owner_id"
- Name: lifecycle_stage
  Description: The contact's lifecycle stage from "properties.lifecyclestage"
```

Downstream steps can then branch on `{{ lifecycle_stage }}` or include `{{ hubspot_owner_id }}` in a notification.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.spara.com/build/workflows/steps/crm-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
