> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/chord-oms/api-reference/authentication.md).

# Authentication

The API provides three means of authentication:

1. An admin level API key
2. A storefront's authentication provider
3. An order's guest token

### API key

You can use your API key to access all resources in the API. The API key must be passed in the `Authorization` header in the following form:

```
Authorization: Bearer API_KEY
```

As an admin, you can find your API token in the admin section under Users > Your e-email > API Access (at `admin/users/<user_id>/edit`)

Example:

```
curl --header "Authorization: Bearer 1a6a9936ad150a2ee345c65331da7a3ccc2de" https://plant-staging.assembly-api.com/api/stores
```

**This authentication method is extremely sensitive should never be used in public contexts.** Instances where it would be appropriate to use this authentication method include:

* Segment functions
* Custom storefront functionality that requires admin level roles that is called server side
* Scripts that import or modify data

### Storefront Authentication

Your storefront can be configured to use a 3rd party authentication provider for your customers to login with. Services that Chord currently supports includes:

* [Stytch](https://stytch.com/)
* [Magic](https://magic.link/)

You may use their opaque tokens like so:

```
curl --header "Authorization: yQscCbXp5EdisdenCal1ovxutnuyhHAlw6ucLfbUWLGn" https://plant-staging.assembly-api.com/api/users/me
```

If the user has no roles (which would make them a customer), this token allows for a subset of operations upon records owned by the user. If the email address matches that of an admin, this token can be used for admin level operations.

If you want to allow your users to perform operations against the API in the browser, this is an advisable method to do so.

### Order token

For allowing guests to manage their cart and place their order, you can use the order's guest token. This token is contained in the `token` property of the order, and it allows you to perform certain checkout-related operations on the order such as managing line items, completing the checkout flow etc.

The order token must be passed in the `X-Spree-Order-Token` header in the following form:

```
X-Spree-Order-Token: ORDER_TOKEN
```

If you are already providing an API key, you don't need to also provide the order token (although you may do so).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/chord-oms/api-reference/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
