> For the complete documentation index, see [llms.txt](https://docs.lingoql.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lingoql.com/sub0/apis-abi/making-api-requests.md).

# Making API Requests

Sub0 APIs are called over standard HTTP(S).

The client stays simple, even when the backend flow is complex.

### Supported content types

Sub0 accepts only:

1. `application/json`
2. `multipart/form-data`

Examples:

```
Content-Type: application/json
```

```
Content-Type: multipart/form-data
```

### Base URL

Each endpoint is exposed by its `resource` or `id`.

```
https://api.your-domain.com/{resource-or-id}
```

`POST` works for every endpoint.

Other HTTP verbs can be enabled in your app configuration when needed.

### JSON request example

```bash
curl -X POST https://api.your-domain.com/user-signup \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sam",
    "email": "sam@gmail.com",
    "password": "secret123"
  }'
```

```javascript
await fetch("https://api.your-domain.com/user-signup", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Sam",
    email: "sam@gmail.com",
    password: "secret123"
  })
});
```

### Protected request example

Protected endpoints expect a token in the configured header.

Default format:

```
Authorization: Bearer <TOKEN>
```

Custom header example:

```bash
curl -X POST https://api.your-domain.com/upload \
  -H "Content-Type: application/json" \
  -H "x-access-token: YOUR_TOKEN" \
  -d '{}'
```

### Upload request example

Upload endpoints use `multipart/form-data`.

```bash
curl -X POST https://api.your-domain.com/upload \
  -H "x-access-token: YOUR_TOKEN" \
  -F "file=@photo.png"
```

```javascript
const form = new FormData();
form.append("file", fileInput.files[0]);

await fetch("https://api.your-domain.com/upload", {
  method: "POST",
  headers: {
    "x-access-token": token
  },
  body: form
});
```

Typical upload response:

```json
[
  {
    "url": "https://storage.lingoql.com/uploads/123/photo.png",
    "file_size": 204800,
    "dominant_color": "#fff"
  }
]
```

### Background endpoints

When an endpoint or actionable sets:

```json
"run_in_background": true
```

the request returns immediately and the work continues in the background.

This is a good fit for emails, webhooks, and long-running jobs.

### Cron jobs

Cron jobs are server-initiated.

They do not need client requests after deployment.

### Webhooks

Webhooks are normal inbound HTTP requests.

Third-party systems send JSON or multipart payloads to your endpoint.

### WebSockets

WebSocket clients connect to your WebSocket route and send stringified JSON messages.

Use [Websockets](/sub0/apis-abi/websockets.md) for the full connection and protection flow.

### The main idea

Sub0 keeps the client contract simple.

You send JSON or files.

Sub0 handles the validation, execution, orchestration, and response shaping behind the scenes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lingoql.com/sub0/apis-abi/making-api-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
