# Call an API or webhook using an automation

> Send an HTTP request from an automation and use the response in later steps.

## Overview

Set up an automation in **Tools** > **Automation Studio** so that when triggered, it uses the **Call a public API** step to send a request from Rippling to an external API or webhook. The response is saved as automation variables you can then use in later steps.

Any application with a documented HTTP API or webhook can be called, and confirm the method, auth, payload, and any subscription or cost requirements in that product’s docs before you build.

> **Note:**
> To trigger an automation in Rippling from an external system, see [Trigger an automation using a webhook](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/trigger-workflow).

### Use cases

-   **IT ticketing** - When a device is locked in Rippling's Device Management, the automation opens a ticket in your external ticketing system.
-   **Custom applications** - When an event happens in Rippling, the automation POSTs to an API you own.

* * *

## Requirements

-   Once the Developer app is enabled for your company, you have access to Automation Studio. For more information, see [Permissions for the Developer app](https://developer.rippling.com/documentation/rippling-platform/developer/permissions).
-   Calling an API or webhook from an automation is tied to your company's Rippling Platform tier. For more information, contact your Account Manager.

* * *

## Setup

### Configure the automation trigger

1.  Select **Tools** > **Automation Studio** > click **Create automation**.
2.  Name the automation and select **Choose your automation trigger** > the trigger that happens inside Rippling (e.g., "A Time Off leave request is approved").
3.  Click **Select**.

### Define the automation step

1.  Click **+Add a step** under the automation trigger > **Call a public API**.
2.  Click the step to open its settings and optionally name the step.
3.  Enter the **URL**. This request URL is required, and automation variables can be inserted.
4.  Select the **HTTP method** expected by the third-party endpoint.
5.  Optionally add **URL query parameters**, a JSON **payload**, and **custom headers**.
    -   **Basic tab:** Enter key-value pairs. Type a static value or use the lightning bolt to insert a variable.
    -   **Advanced tab:** Edit the same fields as JSON.
    -   Use **custom headers** (for example `Authorization: Bearer <token>`) to authenticate the request, following the third-party's API docs.
6.  Optionally add an [Expected API response schema](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/call-api#expected-response-schema) if you want a structured response. To generate a schema from the endpoint, click the generate icon in the header, then remove any fields you do not need. You can also insert automation variables using the lightning bolt icon.
7.  Click **Test step** to test the step before you activate the automation.
8.  Click **Continue** to save the step.
9.  Click **Save** in the top right-hand corner to save as a draft or publish the automation, and **Activate this automation** to complete the publishing process.

> **Note:**
> An automation needs to be both **published and activated** in order to run successfully. You can publish an automation without activating, and activate later using the "Status" toggle on the **Automation Studio** > **Dashboards** homepage. For more information, see [Automation statuses](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/statuses).

If Rippling does not receive a response within **60 seconds**, the call times out and the automation fails. For more information, see [Automation limits](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/limits).

If the automation fails, check the **Execution history** tab in the automation. Common causes are a 60-second timeout, a non-success HTTP status, or a schema that does not match the actual body. For more information, see [Troubleshooting](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/troubleshooting#call-a-public-api-fails).

* * *

## Response variables

Requests are sent as HTTP with a JSON payload, and the response is stored as variables for use in later steps.

| Variable | When it is available | What it contains |
| --- | --- | --- |
| **HTTP response** | Always | Unstructured response (a flattened string of key-value pairs from the body) |
| **URL** | Always | The URL the request was sent to |
| **Structured API response** | Only if you provide an [expected response schema](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/call-api#expected-response-schema) | Fields parsed into separate variables from that schema |

If the response is a list, you can only use it in bulk operations. For more information, see [Automation steps](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/steps#bulk-operations).

### Expected API response schema

Define an API response schema when you need individual fields as variables (for example, an external ticket ID). To create a structured API response, add a JSON schema in the **Expected API response schema** field. The schema must follow the [JSON schema](https://json-schema.org/understanding-json-schema/reference) standard: an `object` with a `properties` entry per field, each with a `type` and an optional `format`.

```json
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string"
    },
    "data": {
      "type": "object",
      "properties": {
        "character": {
          "type": "object",
          "properties": {
            "id": {
              "type": "number"
            },
            "name": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
```

Without a schema, you will receive an **unstructured** HTTP response:

```json
{
  "status": "success",
  "data": {
    "character": {
      "id": 10,
      "name": "joe"
    }
  }
}
```

* * *

## See also

-   [Get started with automations](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/get-started)
-   [Automation steps](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/steps)
-   [Automation variables](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/variables)
-   [Trigger an automation using a webhook](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/trigger-workflow)
-   [Automation statuses](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/statuses)
-   [Automation limits](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/limits)
-   [Automation troubleshooting](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/troubleshooting)
-   [Permissions for the Developer app](https://developer.rippling.com/documentation/rippling-platform/developer/permissions)

Source: https://developer.rippling.com/documentation/rippling-platform/developer/workflows/call-api

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
