Blog

Trigger an AI Agent from a REST API Call

Tutorial

ยท

Quick answer: To trigger an AI agent from a REST API call, add the REST API Call trigger to a BuildShip workflow, set an endpoint path and method (POST is the default), and click Connect. BuildShip gives you a URL that any client, no-code app or partner system can call. Map the request body, query and headers to workflow inputs, and map the workflow output to the HTTP response. In this guide the agent writes a signed PDF quote, stores it and returns the file URL. A general chat agent has no production endpoint, cannot write to your storage and leaves no log of the call.

Trigger an AI agent from a REST API call: an app sends a POST request to the REST API trigger, then a BuildShip AI agent returns a signed PDF quote URL

This is the most general trigger in BuildShip, and it is the one you reach for when the event already lives in your own software. A mobile app, a partner integration, a form, a GPT action or a script can all send an HTTP request. The workflow behind that URL is the AI agent and the backend.

People already look for a โ€œREST API triggerโ€ and an โ€œAI agent API endpoint.โ€ Those are the same problem: how do I call an agent from my app and get a real result back, not a chat transcript?

What a chat agent cannot do here

Ask ChatGPT to โ€œcreate a quote for 40 site licences, net 30, send it to financeโ€ and you will get a well-written quote in the canvas. You will not get:

  • A URL your app can POST to, with a path, a method and a JSON body.

  • A PDF stored in your bucket, signed and named for that request.

  • A quote row in your database, with a reference your finance team can find.

  • A response the app can use, such as { "quoteId": "Q-1842", "url": "https://..." }.

  • A step-level log of the request, the generated file and the response.

The REST API Call trigger is that missing endpoint. It is the right trigger when you, or a system you control, can send an HTTP request. If the event lives in Stripe, GitHub or an inbox, use those triggers instead. If you need to accept a file upload, use the file upload trigger, which is a sibling of this one and has its own post in this series.

What the REST API Call trigger actually does

The trigger starts a workflow when an HTTP request hits a URL that BuildShip generates for you.

You configure:

  • Endpoint Path. This is pre-filled, and you can change it to something you will recognise, such as /quotes. The path supports wildcards, also called path variables, so /quotes/:id can pass id into the workflow. See the path variable docs.

  • Request Method. POST is the default. You can choose another method if the client needs GET, PUT or DELETE.

  • Content-Type, under Advanced Options. Most requests use application/json, which is the default. application/x-www-form-urlencoded and text/plain are also available.

Click Connect, and you get an endpoint URL. That is the URL your app, Postman or a partner system calls.

Because the workflow logic is independent of the trigger, you then map incoming request data to workflow inputs, and workflow outputs to the HTTP response. The trigger output includes Query, Headers and Body. You can use the context menu (x) and dot notation, for example to read prompt from a query parameter, or a lineItems array from the body.

If you are not sure of the request shape, use Get Data. Send one request to the endpoint, then click Get Data on the preview tab. BuildShip fetches the last request, shows it as a tree, and lets you add the fields you need to the input schema. You do not have to do this at the same moment as the request. Any previous request to that endpoint is enough.

A client POSTs to a BuildShip REST API endpoint. The trigger starts an AI agent that writes a signed PDF quote, stores it and returns the file URL

The endpoint is a real API. The agent does the judgement. The response is a quote id and a URL, not a chat message.

A concrete case: return a signed PDF quote

Take a supplier whose sales app already knows the customer, the line items and the payment terms. Today a salesperson hits โ€œCreate quote,โ€ a human types it into a document, and the file comes back later. The app should get a PDF URL in the same request, or at least in the same minute.

Here is the path I would build:

  1. The app POSTs JSON to https://<your-endpoint>/quotes, with customer details, line items, currency and terms.

  2. The REST API Call trigger starts the workflow and maps the body to inputs.

  3. A Branch or script node validates the request: there is at least one line item, amounts are numbers, and a customer id is present. Invalid requests return 400 with a short error, and do not call a model.

  4. An AI step writes the quote wording: a plain-language summary, any caveats that follow from the terms, and a typographic layout for the PDF. It must not invent prices. The amounts come from the request.

  5. A Generate PDF from HTML node turns that HTML into a PDF. Store the file in BuildShip Cloud Storage or your own bucket, under a stable name such as quotes/Q-1842.pdf, and keep the download URL.

  6. The workflow writes a quotes row with the reference, the customer, the totals and the file URL.

  7. The HTTP response is JSON: the quote id, the URL and a status. The app can show โ€œQuote readyโ€ and open the file.

The model is there for wording and layout, not for arithmetic you already trust. If you already generate PDFs in BuildShip, the same Generate PDF from HTML node used for reports and invoices is the one you want here. The difference is the REST API Call trigger in front of it, and a quote record behind it. The storage write, the database row and the HTTP response are what make it an API rather than a chat.

Path variables help if you later add GET /quotes/:id as a second trigger on a retrieval workflow, or POST /quotes/:id/send to email an existing file. The same style of URL, different methods, different work.

Path variables such as /quotes/:id let the same API style support creating a quote, fetching one and sending one, each with its own workflow or trigger

Set a clear path on the trigger. Use path variables when the resource id belongs in the URL.

Set up the trigger

  1. Open a BuildShip workflow and go to the Connect tab. Add REST API Call.

  2. Set the Endpoint Path to something readable, such as /quotes. Add a path variable if the client will pass an id in the URL.

  3. Set the method to POST, and leave the content type as application/json unless your client sends something else.

  4. Click Connect and copy the generated endpoint URL.

  5. Send a sample request from Postman, Hoppscotch or your app. Click Get Data, then add the JSON fields you need to the workflow input schema.

  6. In the triggerโ€™s output mapping, connect the workflow output to the response body, and set a status code. Success can be 200. Validation errors should be 4xx.

You can add more than one trigger to the same workflow if you want, but a clean API usually means one path and method per job. A GET that retrieves a stored quote is a different workflow from the POST that creates it.

Build the quote agent

Validate first. Do not spend a model call on a request that is missing line items. A script or Branch node should return early with a clear error. Log the reason.

Separate numbers from words. Totals, tax and currency formatting should be computed in code from the request. Pass those already-correct figures to the AI node (keyless nodes run on your BuildShip credits, or you can bring your own provider key) with an instruction such as:

> You write supplier quotes. Using the customer name, line items and terms provided, write a one-page quote: a short introduction, the line items as given, the supplied totals, and a closing line about the validity period. Do not change quantities, unit prices or totals. Do not add line items.

Produce the file. Add the Generate PDF from HTML node from the Utilities section of the Node Explorer. It takes HTML and returns a PDF. Pass in the quote HTML you already have: the introduction, the line items and the totals computed in code. Then store the file in BuildShip Cloud Storage or your own bucket and keep the URL. If you need a letterhead or a stamp, put it in the HTML, not in the prompt.

Write the record. Insert a row in quotes with the request payload, the totals, the file URL and a created status. Return that id in the response.

Make retries safe. Sales apps retry when a request times out. If the same customer and line items arrive twice, you should not write two quote rows and two PDFs. Take a client-supplied request id, or hash the customer id with the line items and terms, look that key up before you generate anything, and return the existing quote if it is already there.

Respond quickly. Map the output so the client receives JSON, not HTML. If PDF generation is slow, you can return 202 Accepted with a quote id and let the client poll a GET endpoint, but a straightforward first version can wait for the file and return 200 with the URL.

Return a stable error body. For a 4xx, use a small JSON shape such as { "error": "missing_line_items" } so the app can show a specific message. Keep 5xx for real node failures, which you inspect in the logs.

If the client is a browser. A web app calling the endpoint directly will need CORS headers on the response. Set those in the output mapping or in a script node so the browser can read the JSON. Native apps and server-side partners do not need this.

If you would rather not wire the canvas by hand, click Build with AI to open Compass and describe the flow in plain language. It builds on your actual canvas, so you can still test and edit every step. For quotes that need a longer policy check, the workflow can hand off to an AI agent built with Agent Max.

A chat agent can draft a quote in a conversation. A BuildShip REST API agent receives a POST, writes a signed PDF, stores a quote record and returns JSON, with a log of the call

Your app should get a quote id and a file URL. That is an API, not a chat transcript.

Test it, ship it and call it from the app

  1. Send a POST with a realistic body from Postman or Hoppscotch.

  2. Confirm the PDF is stored, the database row is correct, and the response JSON matches what the app expects.

  3. Click Ship, then point the appโ€™s development environment at the endpoint.

  4. Watch one real request in the logging panel.

Open the logging panel at the bottom of the workspace to see what happened. You can switch from the Workflow view to the Node view to read the logs for a single step, and test runs show live logs as they happen. Production logs usually show up within about 45 seconds, and the refresh icon loads them straight away. To add your own messages, use the Log Message to Console node, or call logging.log inside any nodeโ€™s code.

See the logging docs and the node failure docs for retries. Use version history before you change a live quote template.

If the endpoint should only be called by signed-in users of a Firebase app, use the Firebase Auth Request trigger instead of the open REST API Call trigger. It is the same idea, with the userโ€™s ID token checked before the workflow runs. For public or partner access, put your own API key or signed request check in the first nodes, and reject anything that does not pass.

Built for teams that run this in production

API-backed agents tend to become part of someone elseโ€™s product, so a few things matter beyond the first test:

  • Full code access. Open any node to read or change its JavaScript or TypeScript.

  • Team access control. Role-based access lets you decide who can view a workflow, who can edit it and who can ship it.

  • Your own Google Cloud. Workflows run on Google Cloud, and you can run them in your own Google Cloud project as an enterprise option.

  • A log per request. When a salesperson says a quote never came back, you can open the run and see the request, the file and the response.

An API is also how other tools start a BuildShip agent: a form, a GPT action, a mobile app, or a parent workflow that calls this one. For the wider pattern of listeners versus timers, see Why AI Agents Need Listeners, Not Cron Jobs.

FAQ

Can I trigger an AI agent from a REST API call?

Yes. Add the REST API Call trigger, set a path and method, and click Connect. BuildShip gives you an endpoint URL. An AI node in the workflow runs on each request, and you map the workflow output to the HTTP response.

What methods and content types are supported?

You set the method on the trigger. POST is the default. Under Advanced Options you can set the content type to application/json (the default), application/x-www-form-urlencoded or text/plain.

Can I use path variables in the endpoint?

Yes. The path supports wildcards, or path variables, so a URL such as /quotes/:id can pass id into the workflow. See the path variable docs.

How do I map the request body to my workflow?

Use the context menu to read Trigger Data (Query, Headers and Body), or click Get Data after sending a sample request. Selected fields are added to the workflow input schema and auto-mapped.

How is this different from the file upload trigger?

The REST API Call trigger is for JSON, form-encoded or plain-text requests. If the client is sending multipart/form-data with a file, use the REST API File Upload trigger instead.

How much does it cost to try?

BuildShip plans start with a 7-day trial, and a card is required to start it. See the pricing page for plans and credits.

Start building

Start your 7-day trial (a card is required), add the REST API Call trigger, and POST a sample quote request to the URL BuildShip gives you. If you are building APIs for a larger team, talk to us about enterprise.

You might also like

All it takes is an idea.

Imagine. Build. Ship.

Subscribe to our newsletter

Stay in the loop with product updates and news.

ยฉ 2026 BuildShip, Rowy Inc.

All it takes is an idea.

Imagine. Build. Ship.

Subscribe to our newsletter

Stay in the loop with product updates and news.

ยฉ 2026 BuildShip, Rowy Inc.

All it takes is an idea.

Imagine. Build. Ship.

Subscribe to our newsletter

Stay in the loop with product updates and news.

ยฉ 2026 BuildShip, Rowy Inc.