Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.datkey.dev/llms.txt

Use this file to discover all available pages before exploring further.

What are temporary API Keys?

Time limited API Keys are API Keys that expire after a certain amount of time. They are useful for when you want to give a user access to your API for a limited amount of time. For example, you might want to give a user access to your API for 1 hour, or 1 day, or 1 week. You can do this by creating a Time limited API Key that expires after a certain amount of time.

How to create a Time limited API Key

To create a Time limited API Key, you need to make a POST request to the /keys endpoint. You can read about all the parameters you can send in the API Reference.
curl --request POST \
  --url https://api.datkey.dev/keys \
  --header 'x-api-key: datkey_xxx' \
  --header 'Content-Type: application/json' \
  --data '{
	"api_id":"<API_ID>",
	"prefix":"abc",
	"length":16,
	"meta": {
	  "entity_id": 123
	},
	"expires": 1718718673,
}'
Once the key is created, you can send it to your user. They can then use it to access your API. Once the key expires, they will no longer be able to access your API and the key will be invalidated.