> For the complete documentation index, see [llms.txt](https://flapjax.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flapjax.gitbook.io/docs/rest-api/guides/request-format.md).

# Request Format

Content type, data binding, and automatic string trimming

## Content Type

All `/v1/` endpoints expect `application/json` as the content type. Always include the header:

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

## How Request Data Is Bound

The API accepts data from two sources, in order of priority:

1. **JSON body** (preferred) — If the request has a `Content-Type: application/json` header and a non-empty body, the API parses the JSON body.
2. **Query parameters** (fallback) — If no JSON body is present, the API falls back to reading data from query parameters.

If a JSON body is present but cannot be parsed, the API returns a `FailedBindingJSON` error rather than falling back to query parameters.

## Automatic String Trimming

All string fields in the request body are automatically trimmed of leading and trailing whitespace. For example:

```json
{ "first_name": "  Jane  " }
```

is treated as:

```json
{ "first_name": "Jane" }
```

This applies to top-level string fields and string values inside `attribute_values` maps.

## Example Request

```bash
curl -X POST https://your-domain/v1/people \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "user-001",
    "first_name": "Jane",
    "last_name": "Doe",
    "email": "jane@example.com"
  }'
```
