> For the complete documentation index, see [llms.txt](https://stablemesh.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://stablemesh.gitbook.io/docs/home/stablemesh-doc/developers/api/authentication.md).

# Authentication

The Open API uses a single **secret API key** sent in the `X-API-KEY` header. There is no request signing, no timestamp, and no nonce — just your key over HTTPS.

***

## Your API key

A key looks like:

```
smk_AbCd1234EfGh5678IjKl...
```

* Keys are issued by the Stable Mesh team during onboarding.
* The **full secret is shown only once**, at creation. Store it in your secret manager — it cannot be retrieved again.
* Stable Mesh stores only a hash of your key, never the key itself.

***

## Sending the key

Add the `X-API-KEY` header to every request:

```bash
curl -X POST https://api.stablemesh.io/v1/card/list \
  -H "X-API-KEY: smk_AbCd1234EfGh5678IjKl..." \
  -H "Content-Type: application/json" \
  -d '{}'
```

***

## Errors

| HTTP               | Meaning                                                                                                       |
| ------------------ | ------------------------------------------------------------------------------------------------------------- |
| `401 Unauthorized` | Missing, unknown, or revoked API key. Response: `{"code":11002,"message":"Invalid or revoked API key"}`       |
| `400 Bad Request`  | Authenticated, but the request was invalid (see [Errors](/docs/home/stablemesh-doc/developers/api/errors.md)) |

***

## Rotating & revoking keys

You can hold more than one active key (useful for zero-downtime rotation). To rotate:

1. Ask Stable Mesh to issue a new key.
2. Deploy it to your systems.
3. Ask Stable Mesh to revoke the old key.

{% hint style="warning" %}
Treat your API key like a password. Anyone with it can create cards and move funds from your USDT balance. Never embed it in client-side code or commit it to source control. If a key is exposed, request revocation immediately.
{% endhint %}


---

# 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 following URL with the `ask` and `goal` query parameters:

```
GET https://stablemesh.gitbook.io/docs/home/stablemesh-doc/developers/api/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 `build a script that syncs our docs to a CMS` 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.
