API authorization
Getting Your API Key
To retrieve your API key:
- Go to your project's Console.
- Click on Settings in the top navigation bar.
- Open the API Keys tab.
- You'll see your default key, which has full access to all endpoints.
You can also generate new keys with custom scopes by clicking Create a new API key.
Using Your API Key
You can include your API key in requests in two ways:
Option 1: Query Parameter
Append your API key as an api_key parameter in the URL:
curl --request POST \
--url https://dynalinks.app/api/v1/links?api_key=myApiKey \
--header 'Content-Type: application/json' \
--data '{"name": "Example Dynamic Link", "path": "examples/1", "url": "https://my-website.com/example"}'Option 2: Authorization Header
Pass your API key in the request header as a Authorization: Token myApiKey:
curl --request POST \
--url https://dynalinks.app/api/v1/links \
--header 'Content-Type: application/json' \
--header 'Authorization: Token myApiKey' \
--data '{"name": "Example Dynamic Link", "path": "examples/1", "url": "https://my-website.com/example"}'Master API keys
Most endpoints take a project API key: it belongs to one project, and it can only touch that project.
A few endpoints take a master API key instead. A master key belongs to your user, not a project, so it can work across every project you own:
- everything under Projects, including creating and deleting projects and verifying a custom domain;
- everything under API keys, which manages the project keys themselves.
Send a master key the same way as a project key, in the Authorization: Token <key> header. With a project key those endpoints answer 401 API key is not master; that error means the key itself is fine and the endpoint wants a master
key.
Master API access is switched on per account by Dynalinks. Once it is on, create the key in the Console under Master API keys. Treat it like a password for your whole account: it is not limited to one project.