Skip to content
MyAppBuilder
StableGuide

APIs overview

An API source describes one request to an outside service: the address, the method, headers, parameters, how to authenticate and which part of the answer to use. Once defined in the APIs section, the same source can feed a table or text on a page, be called from a button, or run

APIs overview

An API source describes one request to an outside service: the address, the method, headers, parameters, how to authenticate and which part of the answer to use. Once defined in the APIs section, the same source can feed a table or text on a page, be called from a button, or run inside a workflow.

All requests are made by the server. Your keys live in encrypted secrets and are added to the request there; the visitor's browser only ever sees the response.

When to use

  • Show live information from another system: stock levels, weather, exchange rates, shipping status.
  • Send data to another tool when something happens: create a contact in your CRM, post a message to a chat tool, register a shipment.
  • Look up data on demand: address completion, a product by barcode.

If the other system holds a whole table you want to browse like your own data, consider an external data source instead.

Where APIs are configured

Open APIs in the builder. The left column lists your API sources with their method and host; the editor on the right has four parts:

  1. Request — method, URL, headers, query parameters, body (Requests).
  2. Authentication — none, bearer token, basic auth or API key header, backed by a secret (Authentication).
  3. Response & access — response path, timeout, the Allow calling from the app switch, and the fields known to the data picker (Response mapping).
  4. Test request — send a real request from the builder and inspect the answer (Test request).

Below, Where it's used lists the components and workflows that reference the API. Each API can be duplicated or deleted (deleting warns when it is still in use).

How to add an API

  1. In APIs, click New API → Blank GET request (or JSON placeholder demo to try with public demo data).
  2. Rename it, set the method and URL, add headers or parameters as the service's documentation requires.
  3. If the service needs a key, create the secret in Settings → Environment & secrets and select it under Authentication.
  4. Use Test request to confirm it works and to save the response fields for the data picker.
  5. Use it: in a component's Data tab (API), with the Call API action, or with the Call API workflow step.

Read-only use vs actions

  • Bindings (component Data tab) read: the page loads the API when it opens and shows the result. Only APIs that a visible component actually binds to can be called this way from the published app.
  • Call API action / step can read or write: you pass parameters (from a form, a record, state) and can use the result in later actions. Use POST, PUT, PATCH or DELETE for writes.
  • The Allow calling from the app switch, when off, restricts the API to workflows — useful for anything visitors should never be able to trigger.

Safety rules for outgoing requests

  • Only http:// and https:// addresses.
  • Credentials are not allowed inside the URL (https://user:pass@…); use the Authentication section.
  • Private and internal addresses (localhost, *.internal, private IP ranges) are blocked on production servers; redirects are re-checked.
  • Responses over 2 MB are rejected; each request stops at its timeout (default 10 s, maximum 30 s).

Common mistakes

  • Typing the key into a header. Header values are stored in the project definition; use {{secret.NAME}} or the Authentication section.
  • Forgetting the secret for an environment. The live app uses Production secrets; the builder uses Development.
  • Binding a page to an API that requires parameters. Bindings pass no parameters; use the Call API action when the request depends on user input.

Advanced

An API source is { name, method, url, headers[], query[], body?, auth: { type, secret?, headerName? }, timeoutMs, responsePath?, responseFields?, allowFromClient } in project.apiSources. The published configuration strips url, headers, query, body and auth. Execution: executeApiSource in src/server/apis.ts via safeFetch (src/server/net.ts); runtime routes POST /api/runtime/:id/api/:apiSourceId (bindings) and the actions endpoint.

Related

Was this helpful?