Skip to main content

Authentication

To use the DataGyro API, you need to authenticate your requests using API tokens. This guide explains how to create, use, and manage your API tokens.

Creating API Tokens

To create a new API token:
  1. Log in to your DataGyro account at app.datagyro.com
  2. Navigate to the “API Tokens” tab at app.datagyro.com/tokens
  3. Click the “Create New Token” button
  4. Your new API token will be generated and displayed
  5. Copy your token and store it securely
You can view all your active API tokens, including their full values, anytime on the API Tokens page.
API tokens provide access to your data through the DataGyro API. Treat them like passwords and store them securely. Never share your tokens or commit them to version control systems.

Using API Tokens

To authenticate your API requests, include your API token in the apikey header of each request:
// Example of making an authenticated API request
const response = await fetch('https://platform.datagyro.com/v1/query', {
  method: 'POST',
  headers: {
    'apikey': 'YOUR_API_TOKEN',  // Include your API token here
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query_string: "What were our sales figures for Q1?",
    dataset_id: "118",
    limit: 10
  })
});
# Example using curl
curl --request POST \
  --url https://platform.datagyro.com/v1/query \
  --header 'Content-Type: application/json' \
  --header 'apikey: YOUR_API_TOKEN' \
  --data '{
    "query_string": "Engineers",
    "dataset_id": "118",
    "limit": 10
  }'

Managing API Tokens

Creating Multiple Tokens

You can create multiple API tokens for different applications or environments. This is a best practice that allows you to:
  • Use different tokens for development and production
  • Revoke individual tokens if they’re compromised
  • Track which token is being used for each integration

Deleting Tokens

To delete an API token that’s no longer needed or may have been compromised:
  1. Log in to app.datagyro.com
  2. Go to the “API Tokens” tab at app.datagyro.com/tokens
  3. Find the token you want to delete
  4. Click the “Delete” button next to the token
  5. Confirm the deletion when prompted
Deleting a token immediately revokes access for any applications using that token. Make sure you update your applications with a new token before deleting an active one.

Security Best Practices

To keep your DataGyro account and data secure:
  • Never hardcode API tokens directly in your application code
  • Use environment variables or secure secret management systems
  • Rotate your tokens periodically
  • Delete tokens that are no longer in use
  • Use different tokens for different environments or applications