> ## Documentation Index
> Fetch the complete documentation index at: https://docs.psntools.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> How to get an API key and authenticate your requests to the PSNTools API.

<Note>
  Placeholder. The API is not live yet and none of the details below are final.
</Note>

## API keys

Every request will need an API key. Keys will be created from your PSNTools account settings and shown **once** at creation.

<Warning>
  An API key is not the same thing as your NPSSO token. Your NPSSO is a PlayStation session cookie; an API key is issued by PSNTools. Never send your NPSSO to the API in place of a key.
</Warning>

## Making a request

Pass the key as a bearer token:

```bash theme={null}
curl https://api.psntools.com/v1/accounts/example \
  -H "Authorization: Bearer psn_live_xxxxxxxxxxxx"
```

## Key types

| Prefix      | Environment | Notes                                |
| ----------- | ----------- | ------------------------------------ |
| `psn_test_` | Sandbox     | Returns fixture data, not billed     |
| `psn_live_` | Production  | Real data, counts against your quota |

## Errors

| Status | Meaning                                   |
| ------ | ----------------------------------------- |
| `401`  | Missing or malformed key                  |
| `403`  | Key is valid but lacks the required scope |
| `429`  | Rate limit exceeded                       |

## Keeping keys safe

* Treat a key like a password — anyone holding it can act as your account
* Never commit keys to a repository or ship them in client-side code
* Rotate a key immediately if you think it has leaked

<Info>
  Rotating a key takes effect instantly and does not invalidate your other keys.
</Info>


## Related topics

- [PSNTools API](/api/overview.md)
- [Create a PSNTools account](/account-billing/your-account/create-account.md)
