> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spojit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HTTP Requests

> Make HTTP API requests: GET, POST, PUT, PATCH, DELETE, and more.

The HTTP connector lets your workflows make HTTP requests to any API endpoint. It supports all standard HTTP methods with optional authentication and custom headers.

<Note>
  A connection is **optional**. You can use this connector without a connection for public APIs, or configure a connection to set a base URL and authentication for reuse across requests.
</Note>

## Connection setup (optional)

If you make multiple requests to the same API, configure a connection to avoid repeating the base URL and auth details:

* **Base URL**: Common prefix for all requests (e.g., `https://api.example.com`)
* **Auth Method**: `none`, `bearer`, `api-key`, or `basic`
* **Token / API Key**: For bearer or API key auth
* **Username / Password**: For basic auth

## Tools

<AccordionGroup>
  <Accordion title="http-get: GET request">
    <ParamField body="url" type="string" required>
      URL or path (if base URL is configured).
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "url": "https://api.example.com/users/42",
      "headers": {
        "Accept": "application/json"
      }
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 200,
      "statusText": "OK",
      "headers": {
        "content-type": "application/json; charset=utf-8",
        "x-request-id": "req_abc123"
      },
      "data": {
        "id": 42,
        "name": "Alice Johnson",
        "email": "alice@example.com"
      }
    }
    ```
  </Accordion>

  <Accordion title="http-post: POST request">
    <ParamField body="url" type="string" required>
      URL or path.
    </ParamField>

    <ParamField body="body" type="any">
      Request body. If you keep the default **JSON** editor, the body is JSON-serialized with `Content-Type: application/json` auto-set. If you switch the editor to **Text** (via the ⋮ menu), the body is sent as the raw string; set your own `Content-Type` header to match (`text/plain`, `application/xml`, `application/x-www-form-urlencoded`, etc.).
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "url": "https://api.example.com/orders",
      "body": {
        "customerId": "cust_8f3a",
        "items": [
          { "sku": "WIDGET-01", "quantity": 3 },
          { "sku": "GADGET-05", "quantity": 1 }
        ]
      },
      "headers": {
        "X-Idempotency-Key": "ord_20240315_001"
      }
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 201,
      "statusText": "Created",
      "headers": {
        "content-type": "application/json",
        "location": "/orders/ord_9k2m"
      },
      "data": {
        "id": "ord_9k2m",
        "customerId": "cust_8f3a",
        "total": 149.97,
        "status": "pending"
      }
    }
    ```
  </Accordion>

  <Accordion title="http-put: PUT request">
    <ParamField body="url" type="string" required>
      URL or path.
    </ParamField>

    <ParamField body="body" type="any">
      Request body. If you keep the default **JSON** editor, the body is JSON-serialized with `Content-Type: application/json` auto-set. If you switch the editor to **Text** (via the ⋮ menu), the body is sent as the raw string; set your own `Content-Type` header to match (`text/plain`, `application/xml`, `application/x-www-form-urlencoded`, etc.).
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "url": "https://api.example.com/users/42",
      "body": {
        "name": "Alice Johnson",
        "email": "alice.johnson@example.com",
        "role": "admin"
      }
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 200,
      "statusText": "OK",
      "headers": {
        "content-type": "application/json"
      },
      "data": {
        "id": 42,
        "name": "Alice Johnson",
        "email": "alice.johnson@example.com",
        "role": "admin",
        "updatedAt": "2025-03-15T10:30:00Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="http-patch: PATCH request">
    <ParamField body="url" type="string" required>
      URL or path.
    </ParamField>

    <ParamField body="body" type="any">
      Request body. If you keep the default **JSON** editor, the body is JSON-serialized with `Content-Type: application/json` auto-set. If you switch the editor to **Text** (via the ⋮ menu), the body is sent as the raw string; set your own `Content-Type` header to match (`text/plain`, `application/xml`, `application/x-www-form-urlencoded`, etc.).
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "url": "https://api.example.com/users/42",
      "body": {
        "role": "editor"
      }
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 200,
      "statusText": "OK",
      "headers": {
        "content-type": "application/json"
      },
      "data": {
        "id": 42,
        "name": "Alice Johnson",
        "role": "editor",
        "updatedAt": "2025-03-15T11:45:00Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="http-delete: DELETE request">
    <ParamField body="url" type="string" required>
      URL or path.
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "url": "https://api.example.com/users/42"
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 204,
      "statusText": "No Content",
      "headers": {
        "x-request-id": "req_del_xyz789"
      },
      "data": ""
    }
    ```
  </Accordion>

  <Accordion title="http-head: HEAD request">
    Returns response headers only (no body).

    <ParamField body="url" type="string" required>
      URL or path.
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "url": "https://cdn.example.com/assets/logo.png"
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 200,
      "statusText": "OK",
      "headers": {
        "content-type": "image/png",
        "content-length": "24580",
        "cache-control": "public, max-age=86400",
        "etag": "\"abc123def456\""
      }
    }
    ```
  </Accordion>

  <Accordion title="http-request: Generic HTTP request">
    Make a request with any HTTP method.

    <ParamField body="method" type="string" required>
      HTTP method: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, or `OPTIONS`.
    </ParamField>

    <ParamField body="url" type="string" required>
      URL or path.
    </ParamField>

    <ParamField body="body" type="any">
      Request body. If you keep the default **JSON** editor, the body is JSON-serialized with `Content-Type: application/json` auto-set. If you switch the editor to **Text** (via the ⋮ menu), the body is sent as the raw string; set your own `Content-Type` header to match (`text/plain`, `application/xml`, `application/x-www-form-urlencoded`, etc.).
    </ParamField>

    <ParamField body="headers" type="object">
      Custom HTTP headers.
    </ParamField>

    <ParamField body="timeout" type="number">
      Request timeout in milliseconds.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "method": "OPTIONS",
      "url": "https://api.example.com/uploads",
      "headers": {
        "Origin": "https://app.example.com"
      }
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "status": 204,
      "statusText": "No Content",
      "headers": {
        "access-control-allow-origin": "https://app.example.com",
        "access-control-allow-methods": "GET, POST, PUT, DELETE",
        "access-control-allow-headers": "Content-Type, Authorization"
      },
      "data": ""
    }
    ```
  </Accordion>
</AccordionGroup>
