Skip to content

Fundamentals

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.

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.

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 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
Sign up
2

Get your API key

Navigate to the SignatureAPI Dashboard 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
Settings > API Keys
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.

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 TypeFormatPurpose
Test keyskey_test_...Development and testing without real legal consequences
Live keyskey_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 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 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, 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 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

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

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

Next steps

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