---
title: "Call your own API from a workflow"
description: "Add a Custom API action to call your own endpoint mid-conversation, test it, and use what comes back in later steps."
url: https://help.gleap.ai/fr/articles/314-call-your-own-api-from-a-workflow
collection: "Workflows"
updated: 2026-11-01
language: fr
alternates: [en]
---

# Call your own API from a workflow

Add a Custom API action to call your own endpoint mid-conversation, test it, and use what comes back in later steps.

A workflow doesn't have to stay inside Gleap. The **Custom API action** step calls an endpoint of yours during a conversation, to look up an order, check a subscription or record something in your own system, and what comes back can be used by the steps that follow. It works in conversation, pipeline and survey workflows.

### Set up the call

1.  In the workflow, click **Add step** and choose **Custom API action** (under **Workflow & integration**).
    
2.  Enter an **Action name**, such as "Get customer orders". This is what you'll pick in later steps to use the result.
    
3.  Enter the **API URL** and choose the method: POST (the default), GET, PUT, PATCH or DELETE.
    
4.  Under **Headers**, add what your endpoint needs for authentication with **Add Header**.
    
5.  Under **Request body**, either keep **Send all available data** on, or switch it off and write your own JSON body. GET requests have no body.
    
6.  Click **Send test request** and check what comes back.
    
7.  Paste an **Example response** (see below), then close the panel.
    

Placeholders work in the URL, the headers and the body, so you can pass through what Gleap already knows: the contact, the ticket, and values collected earlier in the flow.

![Custom API action with fictional example JSON and a reserved example.com endpoint in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/rtjemKdcGylkrydRcdxkjf3Sm7Dn1U3k97grurHFyQDwJZdhUcUabSkXT5rNZuFl78JwtsTgdXl.png)

### Paste an example response

This is the field that makes the rest work. Paste an example of what your API returns, and Gleap uses it to know which fields exist. Later steps then offer those fields to you instead of asking you to remember the shape of your own JSON.

> **Info:** Paste a realistic example, not a minimal one. If a field is sometimes an empty list or sometimes absent, an example showing it filled in is what lets you build the step that uses it.

### Use the result

Once the call succeeds, its data is available downstream: put an order status into a **Write a message** step, branch on whether a subscription is active with a **Condition**, or store a value with **Set data attribute**.

Pair it with **Buttons from API** where the options themselves come from your data. A customer choosing which of their three orders they're asking about is a far better experience than typing an order number.

### Design for failure

Your endpoint will be slow or unavailable at some point, and the customer is waiting in a live conversation while it happens. The step has no timeout setting and no separate failure path, so build one yourself: after the call, add a **Condition** that checks a field you expect in the response (you'll find the fields under **API action results**), and send the other branch to a person. Handing over is a perfectly good outcome, and better than a flow that stops with nothing said.

Keep the endpoint fast and return the smallest useful response.

> **Warning:** Verify on your side who is asking. The workflow tells your endpoint which contact it's about, but that's information from a conversation, so don't return account data on the strength of it alone.

### Related

-   [Workflow steps reference](https://help.gleap.ai/en/articles/312-workflow-steps-reference.md)
    
-   [Build a workflow](https://help.gleap.ai/en/articles/311-build-a-workflow.md)
    
-   [Test a workflow before publishing it](https://help.gleap.ai/en/articles/315-test-a-workflow-before-publishing-it.md)
    
-   [Connect a tool to an agent](https://help.gleap.ai/en/articles/248-connect-a-tool-to-an-agent.md)
