> For the complete documentation index, see [llms.txt](https://docs.partssource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.partssource.com/api/getting-started/request-headers.md).

# Request headers

This page documents the HTTP headers used when making requests to PartsSource APIs.

## Authorization

All API requests require an `Authorization` header with a Bearer token:

```
Authorization: Bearer {your-access-token}
```

See [Authentication](/api/authentication/overview.md) for details on obtaining an access token.

## Idempotency-Key

The `Idempotency-Key` header is **required** for order creation (`POST /orders`) and prevents duplicate orders when retrying failed requests.

### Purpose

Network failures, timeouts, or client errors can cause uncertainty about whether a request succeeded. Without idempotency, retrying a `POST /orders` request could create duplicate orders. The `Idempotency-Key` header ensures that retrying the same request returns the original response instead of creating a new order.

### Format

The header value must be a valid UUID (version 4 recommended):

```
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000
```

### Example Request

```bash
curl --location \
--request POST 'https://api.partssource.com/customer/orders' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your-access-token}' \
--header 'Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000' \
--data '{
  "facilityId": "FAC-001",
  "lineItems": [
    {
      "partNumber": "PART-12345",
      "quantity": 1
    }
  ]
}'
```

### Behavior

| Scenario                         | Result                                             |
| -------------------------------- | -------------------------------------------------- |
| First request with a new key     | Order is created, response returned                |
| Retry with the same key          | Original response is returned (no duplicate order) |
| New request with a different key | New order is created                               |

### Best Practices

* Generate a new UUID for each unique order intent
* Store the key before sending the request so you can retry with the same key if needed
* Do not reuse keys across different orders
* Keys are typically valid for 24 hours

## Content-Type

For requests with a body (`POST`, `PUT`, `PATCH`), include:

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


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.partssource.com/api/getting-started/request-headers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
