> For the complete documentation index, see [llms.txt](https://docs.feathery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.feathery.io/platform/build-forms/advanced-logic/visual-rule-builder/connect-to-api-action.md).

# Connect to API Action

Send or receive data to/from any API without having to write code

Feathery's No-Code API Connectors, an extension of our no-code Rule Builder, allows you to send or receive data to/from any API without having to write code, all within any Feathery form or workflow.&#x20;

### Example Use Cases:

* Dynamically rendering options for a drop-down
* Looking up a user in a database or CRM (ex: Salesforce, HubSpot) and prefilling their information
* Sending form data to your custom API endpoints
* Running custom validation logic from an API (ex: verify if a user's identity is valid)

### Video Demo

{% embed url="<https://www.loom.com/share/9a8b8df8cb0d4578b2511b68fb188c74>" %}

### How to access

Within the Logic tab of your form, create a Rule within Feathery's No Code Rule Builder. Then, within a Rule, you can define an Action for "Connect to API" which kickstarts the No Code API Connector flow.

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2FEx8rIvqLdSXC0QNxFlRV%2Fimage.png?alt=media&amp;token=71819d8a-5a42-43e1-b7bf-d4284ec6e710" alt=""><figcaption></figcaption></figure>

### 1. Define the endpoint &#x20;

First, go to the Logic tab of your form, click "API Connectors" and press the "Create API Connectors" button.

Set the endpoint you want to use and any headers you want to send. Please refer to your intended API's documentation to determine which endpoint and headers to use.  You must also set what type of API request you need to make, such as a GET request for receiving information into your form or a POST request for sending form data to an API.&#x20;

You can also define what data you want to send to the request. You can reference field values for these as well using the {{field\_name}} syntax.

Any data you define in the headers or query parameters (such as sensitive API keys) will not be exposed client side to people filling your form.&#x20;

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2FRmhR8y1jZE53VNVPIyf0%2Fimage.png?alt=media&amp;token=e0b40d23-5f3e-4182-be14-61a6ea988dd3" alt="" width="375"><figcaption></figcaption></figure>

For POST requests, you can define the request body that you want to POST to your endpoint. The format is a key (as a string) followed by a string value, with any variables included within the string enclosed in double curly braces, such as:

`{ "sample_key" : "{{sample_field_id}}" }`

Make sure each field is defined and published first before referencing the field in the request body.

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2FB8ZPmbB3OvzB4r8w6gV1%2Fimage.png?alt=media&amp;token=db2fd2f6-c302-4c90-838d-caf3fdf6e4f1" alt=""><figcaption><p>Example POST request</p></figcaption></figure>

### 2. Define the API response format

You can define the API response format in two ways:

**Option 1: Make a test API call**

You can run a test API call with the parameters you defined in the previous step to see the result. If you used any field values for headers or query parameters, you can define them prior to the test API call being run.

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2F6RirPJRFc8v3TSTHcGcG%2Fimage.png?alt=media&amp;token=c5e6c43f-9abf-48d8-9587-accebc7806f7" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2F7t0t5xNhHlt83AUmhHRC%2Fimage.png?alt=media&amp;token=d914f0b0-e13d-4afa-8651-17e2a0832608" alt="" width="375"><figcaption></figcaption></figure>

**Option 2:** Input a sample JSON response

You can also paste a sample response (ex: from the API docs) in case you may not be able to call the API just yet

### 3. Map the API result to form fields

You can configure how to extract data from the API's response. You can configure which fields you want to map to and which parts of the API response to pull from (ex: certain fields in the respones or indices of an array).&#x20;

Feathery supports pulling and mapping data from nested response fields and lists/arrays.

For example, in the screenshot below, we are mapping the "salesforce-full-name" field to the "Name" field of the first element "records" key in the response json, which is represented by the syntax "records.0.Name" (where 0 represents the 0th/first index of the array/list). You can use the dropdown to see all available mappings.&#x20;

You can also map multiple fields at once. In this case, we are mapping both the Account Name and Full Name fields.

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2FVhVQ3jdLF0T8GHHkeX94%2Fimage.png?alt=media&amp;token=bb480494-c915-4688-bf83-89c6246e56a8" alt=""><figcaption></figcaption></figure>

### 4. Use the No-Code API Connector in a Logic Rule

Go to the Logic tab of your form and create a Rule. Set the action of your rule to "Connect to API" and select the API connector you created in the previous step. Then, the API connector will run when the rule's trigger is activated.

In the example below, we connect to the Salesforce API whenever the "salesforce-email" field is changed.

<figure><img src="https://640450274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHAVngDAEk3s8Bw7P6Ntz%2Fuploads%2FsAuIkfoGNEumnAZYIX0a%2Fimage.png?alt=media&amp;token=86cc0c4e-3a8e-41b3-b8c5-911c81c336ff" alt=""><figcaption></figcaption></figure>

## Variables

When defining and using your connectors, you may also have access to backend environment variables such as authentication tokens. You may define these via double curly braces in either the API connector headers or the url being passed into the `feathery.http` interface.

The authentication token for **any connected integration** can now be used in API connectors. The syntax to reference the auth token is `{{integration-name_token}}.`

Example variables that you have access to include (but are not limited to):

* `{{feathery_user_id}}` - the unique ID of the current submission / form end-user
* `{{feathery_form_id}}`- the ID of the current form
* `{{<Integration Type>_token}}` - auth token of your integration, if active. This can be `salesforce_token` , `hubspot_token`, `emoney_token`, `google-sheets_token`, etc.
* `{{FeatheryDocument:<Document ID>}}` - this allows you to include a link to a generated / e-signed document envelope.
* `{{feathery_auth_email}}` - the authenticated email address of your current user, if an auth integration like [Stytch](https://feathery.io/integrations/stytch) or [Firebase](https://feathery.io/integrations/firebase) is turned on

## Pass File Binary via URL

To pass the binary of a file directly as the request body, you may define the request body in the specific format `{"FeatheryBinaryData": "<URL>"}`, where the URL points to a file whose content should be downloaded and passed directly as the request body.

The `Content-Type`request header will automatically be set to the type of the file. If you specify a query parameter with the value `{{feathery_file_name}}`, that will automatically be set to the name of the file (with its file extension).

You can also use the format `{"FeatheryBinaryData": ["<URL>"]}` where an array of URLs are specified. In this approach, the API request will be issued multiple times, once with each URL's binary data passed. The responses will be returned in an array to the logic rule that initiated the connector, while the returned field values will be the combined values from all of the responses.

For example, you could pass `{"FeatheryBinaryData": "{{MultiFileUpload}}"}` where `MultiFileUpload`corresponds to the ID of a multi-file upload field in Feathery. This would allow passing the binary of each uploaded file within the field.

## Upload a File as a Multipart File Part

When the request's `Content-Type` header is `multipart/form-data`, each key in the request body is sent as a form field. To send a key as a **file part** (with a filename, as upload endpoints such as Guidewire InsuranceNow require), give it a value in this format:

```json
{
  "description": "Underwriting summary",
  "file": {
    "FeatheryFile": "{{UWSummaryPDF}}",
    "filename": "uw-summary.pdf",
    "content_type": "application/pdf"
  }
}
```

* `FeatheryFile` is the file's source: an `https` URL to download (for example a file upload field like `{{UWSummaryPDF}}`, or `{{FeatheryDocument:<id>}}`), a standard padded base64 string of at least 64 characters, or a `data:` URI such as `data:application/pdf;base64,...` (use this form for a shorter base64 payload). Downloads must come from public hosts. One request can send at most 20 files and 50 MB in total. A source that can't be downloaded or decoded fails the request before it is sent, and the failure is recorded in the connector's error log like an endpoint error.
* `filename` is optional. It defaults to the name the download reports (its `Content-Disposition` header or final URL), or `file` for base64 data.
* `content_type` is optional. It defaults to the `Content-Type` the download returned or the MIME type in a `data:` URI, otherwise it is guessed from the filename, falling back to `application/octet-stream`.

If `FeatheryFile` is an array of sources (for example a multi-file upload field), one file part is sent per file under the same field name, all in a single request. Each part takes its filename and content type from its own file, so `filename` and `content_type` only apply to a single source. This differs from `FeatheryBinaryData`, which sends the file bytes as the whole request body and repeats the request once per file.

Text fields are sent before file parts, which suits endpoints that expect the file after the fields describing it.

## IP Address Whitelist

API connector requests will always originate from `54.177.134.134`, so you can whitelist this specific IP address on the recipient endpoint.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.feathery.io/platform/build-forms/advanced-logic/visual-rule-builder/connect-to-api-action.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
