Generate an API Key

Quick start guide for API Key Development

Often developers prefer a simple, application centric authentication method such as an API Key. Fortunately, Space and Time makes it very easy to generate and manage API Keys using Space and Time Studio!

To Generate or Manage API Keys:

  1. Navigate to Space and Time Studio, click on "Sign in" in the upper-right most corner, and login.

  2. Click on "My Account" in the upper-right most corner (replaces "Sign in") and click on the "Permission and Keys" tab.

  3. On that tab, you will see an API Key section. If you have no defined API Keys, the UI will display the "Create API Key" view:

  4. To create a new API Key, simply add a note (to remind yourself where/how the key will be used) and click "Add"

🚧

Copy and save your API Key! It will never be shown again! If you forget to copy, you'll have to delete and re-create a new key.

👍

Congrats! You've just created your first API Key!


If you have existing keys, you should see the "API Key" management view instead:

From here, you can see existing keys and delete keys (using the trash-can icon on the right).

What is the difference between API Keys are Access Tokens?

An ACCESS_TOKEN is the cryptographic session generated by the Space and Time decentralized network directly, meaning you're connected to the network. Generating an ACCESS_TOKEN requires authentication using an async public/private keypair login and expire every 25 minutes, making it the most secure authorization method, but also slightly more difficult to use.

An API key is managed by a Space and Time Gateway / Secrets Proxy, meaning it is authenticating to a near-chain auth server instead of the decentralized network itself. You can use an API Key to run queries, however there are some API calls that require an ACCESS_TOKEN. However, API Keys are very familiar to most developers, making them easy and fast to work with.

You can always use your authenticated API Key to request a full network ACCESS_TOKEN, allowing your application access to the entire suite of decentralized network APIs using an API Key.

Can I turn my API Key Authorization into an Access Token?

While you can run queries natively with your API Key authentication, there are some API calls that require an ACCESS_TOKEN to fully authenticate. Fortunately, it's easy to use your API Key to generate an ACCESS_TOKEN, with one simple API call:

Head over to the API reference page: https://docs.spaceandtime.io/reference/apikey-authn

From there, you'll be able to drop in your API Key and get back an access token immediately, by simply clicking the "Try It" button on the right, or you can see examples of how to make the API call in your code for a more programmatic approach.