Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

HTTP Request

The HTTP Request action lets you call any HTTP endpoint from an API Endpoint. Configure method, URL, body/query params, headers, authentication, retries, and timeouts. Because this runs on the server, you can safely use Secure environment variables for API keys and secrets.

Method

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • HEAD
  • OPTIONS

This is the “type” of request you’re making:

  • Use GET when you want to retrieve data (for example, get a list of products).
  • Use POST when you want to create something (for example, create an order).
  • Use PUT or PATCH when you want to update something.
  • Use DELETE when you want to remove something.

URL

This is the full address of the API endpoint you want to call.

  • It’s required.
  • You can bind it (for example, use an environment variable for the base URL).

URL params

Some APIs expect values inside the URL, like an ID:

  • Example URL: https://api.example.com/users/:id

When your URL contains /:something, WeWeb shows a URL Params section where you can fill in id.

Data

Query parameters

Use Query Parameters to add key/value pairs to the end of the URL.

  • Example: { "search": "boots", "page": 1 }
  • The final URL becomes something like: ...?search=boots&page=1

This is commonly used for searching, filtering, sorting, and paging.

Body

Use Body to send data to the API (for example, the details of a new order).

  • This is usually used with POST, PUT, or PATCH.
  • By default, the body is sent as JSON (which is what most APIs expect).

Authentication (optional)

Authentication is how you prove to the API that your request is allowed.

In Auth, choose one of these:

  • None: The API is public or doesn’t require sign-in.
  • Basic: You send a username + password (less common for modern APIs).
  • Bearer: You send a token (very common). This usually looks like Bearer <token>.

USE ENVIRONMENT VARIABLES

Bind credentials from Secure environment variables so they don’t get exposed.

What to fill

  • For Basic, fill Username and Password.
  • For Bearer, fill Token.

Headers (optional)

Headers are extra settings you send with the request. Many APIs use headers for authentication and for telling the API what format you’re sending.

Add custom headers as an object. Common examples:

json
{
  "Content-Type": "application/json",
  "X-Api-Key": "{{env.API_KEY}}"
}

You can bind Secure environment variables in headers to keep your API keys safe.

Retry configuration (optional)

Retries are helpful when an API sometimes fails temporarily (for example, a short network issue).

  • Max Attempts: How many extra tries to do after the first try. Use 0 to disable retries.
  • Retry Type:
    • Linear: Wait the same amount each time.
    • Exponential: Wait longer and longer each time (useful when an API is rate-limiting you).
  • Delay (ms): How long to wait between tries (for Linear).
  • Base Delay (ms) And Max Delay (ms): How the wait time grows (for Exponential).

Use retries for flaky networks or 429/5xx responses. Avoid retrying actions that could create duplicates (for example “create order”) unless the API explicitly says it’s safe to retry.

Advanced options

Throw on Error

When this is enabled, WeWeb treats non‑success responses (for example 401 or 500) as an error. This makes it easier to handle problems with Try/Catch.

Timeout (ms)

This is the maximum time WeWeb will wait before it stops the request.

If you set it too low, slow APIs may fail. If you set it too high, your workflow may feel slow when the API is down.

Result shape

On success, the action returns an object similar to:

json
{
  "status": 200,
  "headers": { "...": "..." },
  "data": { /* parsed JSON or text */ }
}

In later actions, you’ll usually bind:

  • result.data For the returned data, or
  • result.status If you need to check whether it worked.

Examples

GET with query params

  1. Method: GET
  2. URL: https://api.example.com/search
  3. Query Parameters: Bind { q: inputs.query, limit: 20 }

POST JSON with Bearer token from environment variable

  1. Method: POST
  2. URL: https://api.example.com/orders
  3. Body: Bind { items: inputs.items, customerId: inputs.userId }
  4. Auth: Bearer → Token: Bind from Secure environment variable env.API_TOKEN

Handle errors

Use Try/Catch to handle errors gracefully. In the Catch branch, you can log the error or send an error response back to the caller.

SECURE API KEYS

Always use Secure environment variables for API keys and secrets. Never hardcode them in your workflows.

Environment variables →

CONTINUE LEARNING

Learn how to handle errors in your API Endpoints.

Error handling with Try/Catch →