---
title: "Authentication"
description: "Authenticate SignatureAPI requests with an API key in the X-API-Key header: get a key, tell test and live keys apart, rotate keys, and fix auth errors."
canonical: "https://signatureapi.com/docs/api/authentication"
source: "https://signatureapi.com/docs/api/authentication.md"
last_verified_api_version: "1.18.0"
last_modified: "2026-11-18T18:19:06Z"
---

# Authentication

Authenticate SignatureAPI requests with an API key in the X-API-Key header: get a key, tell test and live keys apart, rotate keys, and fix auth errors.

_Last verified against API version 1.18.0._

SignatureAPI uses **API key authentication** to secure access to your account and ensure only authorized requests can create, modify, or access your envelopes and documents.

## How authentication works

All API requests require authentication using an API key passed in the `X-API-Key` header.

When you make a request, SignatureAPI validates your API key and determines which account and environment (test or live) the request should access.

> **Warning:** Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

## Getting your API key

You can get a free test API key to try out SignatureAPI and set up your workflow:

1. **Sign Up**

   [Sign up](https://accounts.signatureapi.com/sign-up) for a free account on SignatureAPI.

   ![The Create your account form with first name, last name, email address and password fields, a Continue button, and Google and Microsoft sign-up options](https://signatureapi.com/docs/images/captured/auth/sign-up.webp)

   *Sign up*

2. **Get your API key**

   Navigate to the SignatureAPI [Dashboard](https://dashboard.signatureapi.com/settings/api-keys) and copy your test API key from the API Keys section.

   ![The API Keys page with the test API key, shown masked, its copy button and the Roll button, and the Live API Keys section](https://signatureapi.com/docs/images/captured/auth/api-keys.webp)

   *Settings > API Keys*

> **Tip:** From a terminal, `npx signatureapi init` signs you in and writes your test API key into your project's `.env` file without printing it. See [CLI API keys](https://signatureapi.com/docs/cli/api-keys).

## Making authenticated requests

Include your API key in the `X-API-Key` header with every request. Here's how to authenticate when getting an envelope:

```http
GET /v1/envelopes/eb4cf433-a8af-4161-b37b-7ef57d423e56 HTTP/1.1
Host: api.signatureapi.com
X-API-Key: YOUR_API_KEY
```

Send the key alone as the header value. Don't add a `Bearer` prefix, and don't send it in the `Authorization` header: the API reads only `X-API-Key`.

## API key types

SignatureAPI provides different API key types for different environments:

| Key Type  | Format         | Purpose                                                 |
| --------- | -------------- | ------------------------------------------------------- |
| Test keys | `key_test_...` | Development and testing without real legal consequences |
| Live keys | `key_live_...` | Production use with legally-binding documents           |

The key's prefix decides the mode of every request: a test key creates and reads only test-mode resources, and a live key only live-mode ones. [Test Mode](https://signatureapi.com/docs/api/test-mode) explains what changes between the two.

An account has one test key and up to four live keys. Live keys need an active paid plan: subscribe to a plan in [Dashboard billing settings](https://dashboard.signatureapi.com/settings/billing) before you create one.

## Rotating API keys

Rotate a key when it may have leaked, or as routine hygiene. You have two options:

- **Roll the key.** Rolling replaces the key's value, and the old value stops working at once. Roll the test key from the [Dashboard](https://dashboard.signatureapi.com/settings/api-keys), and any key with `npx signatureapi api-keys roll`. Deploy the new value right away, because requests with the old one fail with `401`.
- **Create, then revoke.** For a live key, create a second live key, deploy it, and then delete the old key in the Dashboard (or revoke it with the CLI) once no traffic uses it. This avoids any window of failed requests. The test key can't be revoked, so roll it instead.

See [CLI API keys](https://signatureapi.com/docs/cli/api-keys) for the `roll`, `create`, and `revoke` commands.

## Authentication errors

When authentication fails, you'll receive specific error responses to help you diagnose the issue:

### Invalid API Key

**HTTP status code: 401**

The API key is missing, not valid, or improperly formatted.

```json
// HTTP/1.1 401 Unauthorized
{
  "type": "https://signatureapi.com/docs/v1/errors/invalid-api-key",
  "title": "Invalid API Key",
  "status": 401,
  "detail": "Please provide a valid API key in the X-API-Key header."
}
```

**Common causes:**

- Missing or incomplete API key
- API key not passed in the `X-API-Key` header, or sent with a `Bearer` prefix
- Typos in the API key value
- A key that was rolled or revoked

[Learn more about Invalid API Key errors](https://signatureapi.com/docs/v1/errors/invalid-api-key)

### Forbidden Access

**HTTP status code: 403**

Your API key is valid but doesn't have permission to access the requested resource.

```json
// HTTP/1.1 403 Forbidden
{
  "type": "https://signatureapi.com/docs/v1/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The requested resource exists, and the API key is valid, but the API key does not have permission to access it."
}
```

**Common causes:**

- Using an API key from a different account
- Insufficient permissions for the requested operation

[Learn more about Forbidden errors](https://signatureapi.com/docs/v1/errors/forbidden)

### Test/Live Mode Mismatch

**HTTP status code: 403**

You're trying to access a resource with the wrong environment key (test vs live).

```json
// HTTP/1.1 403 Forbidden
{
  "type": "https://signatureapi.com/docs/v1/errors/mode-error",
  "title": "Mode Error",
  "status": 403,
  "detail": "You are trying to access a test-mode resource with a live API key. Please use a test API key."
}
```

**Common causes:**

- Using a test API key to access live resources
- Using a live API key to access test resources

[Learn more about Mode errors](https://signatureapi.com/docs/v1/errors/mode-error)

## Next steps

Now that you understand authentication, you're ready to:

- [Create your first envelope](https://signatureapi.com/docs/api/guides/quickstart) using the API
- [Explore the API playground](https://signatureapi.com/docs/api/playground) to test requests interactively
