API Authentication
DocSpring uses API tokens for authentication. You can authenticate using HTTP basic authentication. Use your API token ID as the username, and the API token secret as the password.
Manage API Tokens Manage your API tokens in the DocSpring dashboard
Environment Variables
Section titled “Environment Variables”All DocSpring API clients support authentication via environment variables. Set the following environment variables, and the client will automatically use them:
DOCSPRING_TOKEN_ID
- Your API token IDDOCSPRING_TOKEN_SECRET
- Your API token secret
This allows you to keep your credentials out of your code:
export DOCSPRING_TOKEN_ID="your_token_id"export DOCSPRING_TOKEN_SECRET="your_token_secret"
Then initialize the client without passing credentials:
# Rubyclient = DocSpring::Client.new # Automatically uses ENV variables
# JavaScript/TypeScriptconst client = new DocSpring.Client(); // Automatically uses process.env
# Pythonclient = docspring.Client() # Automatically uses os.environ
HTTP Basic Authentication
Section titled “HTTP Basic Authentication”“HTTP basic authentation” means that you need to send an Authorization
header with
the value Basic
followed by token_id:token_secret
in Base64 encoding.
Some tools such as curl
can create the Authorization
header for you:
curl -u API_TOKEN_ID:API_TOKEN_SECRET \ https://sync.api.docspring.com/api/v1/authentication
Or you can create the Base64 encoded string manually:
# echo -n "API_TOKEN_ID:API_TOKEN_SECRET" | base64QVBJX1RPS0VOX0lEOkFQSV9UT0tFTl9TRUNSRVQ=
curl -H "Authorization: Basic QVBJX1RPS0VOX0lEOkFQSV9UT0tFTl9TRUNSRVQ=" \ https://sync.api.docspring.com/api/v1/authentication
Next Steps
Section titled “Next Steps” API Reference: Test Authentication View code samples to learn how to set up authentication for your API client.
Click the Test Request button to try it out using your own API token.
Click the Test Request button to try it out using your own API token.