Authentication

Secure access to the QODRYX API

Overview

The QODRYX API uses API keys to authenticate requests. You can view and manage your API keys in the Dashboard Settings. All API requests must include a valid API key in the header.

Keep Your API Keys Secure

Your API keys carry many privileges. Do not share them in client-side code, public repositories, or expose them in any way.

Authentication Methods

API Keys

API keys are the primary authentication method for server-to-server communication:

# Include your API key in the Authorization header
curl -X GET "https://api.qodryx.com/v1/projects" \
  -H "Authorization: Bearer qx_live_abc123def456..."

# Or use the X-API-Key header
curl -X GET "https://api.qodryx.com/v1/projects" \
  -H "X-API-Key: qx_live_abc123def456..."

API Key Types

TypePrefixUse Case
Liveqx_live_Production environment
Testqx_test_Development/testing
Read-onlyqx_ro_Read-only access

Personal Access Tokens (PAT)

PATs are useful for CLI tools and personal automation scripts:

# Generate a PAT from Dashboard → Settings → API Keys → Create Personal Token

# Use in CLI
qodryx auth login --token qx_pat_abc123...

# Use in API requests
curl -X GET "https://api.qodryx.com/v1/user" \
  -H "Authorization: Bearer qx_pat_abc123..."

OAuth 2.0

For applications that need to act on behalf of users:

# 1. Redirect user to authorization URL
https://auth.qodryx.com/oauth/authorize?
  client_id=YOUR_CLIENT_ID&
  redirect_uri=YOUR_REDIRECT_URI&
  response_type=code&
  scope=read:projects write:workflows&
  state=RANDOM_STATE_STRING

# 2. Exchange authorization code for access token
POST https://auth.qodryx.com/oauth/token
Content-Type: application/json

{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "code": "AUTHORIZATION_CODE",
  "redirect_uri": "YOUR_REDIRECT_URI",
  "grant_type": "authorization_code"
}

# 3. Response
{
  "access_token": "qx_oauth_abc123...",
  "refresh_token": "qx_refresh_xyz789...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "read:projects write:workflows"
}

Creating API Keys

1

Go to API Settings

Navigate to Dashboard → Settings → API Keys

2

Create New Key

Click 'Create API Key' and give it a descriptive name

3

Set Permissions

Choose the scopes and permissions for this key

4

Copy Key

Copy the key immediately - it won't be shown again

Scopes & Permissions

API keys can be restricted to specific scopes:

ScopeDescription
read:projectsView projects and their settings
write:projectsCreate and modify projects
read:workflowsView workflows and their status
write:workflowsCreate, trigger, and modify workflows
read:securityView security scan results
write:securityTrigger scans and manage findings
read:deploymentsView deployment history and status
write:deploymentsTrigger deployments and rollbacks

SDK Authentication

JavaScript/TypeScript

import { Qodryx } from '@qodryx/sdk';

// Initialize with API key
const client = new Qodryx({
  apiKey: process.env.QODRYX_API_KEY,
});

// Make authenticated requests
const projects = await client.projects.list();

Python

from qodryx import Qodryx

# Initialize with API key
client = Qodryx(api_key=os.environ['QODRYX_API_KEY'])

# Make authenticated requests
projects = client.projects.list()

CLI

# Authenticate CLI
qodryx auth login

# Or use environment variable
export QODRYX_API_KEY=qx_live_abc123...
qodryx projects list

Token Refresh

OAuth access tokens expire after 1 hour. Use the refresh token to get a new access token:

POST https://auth.qodryx.com/oauth/token
Content-Type: application/json

{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "refresh_token": "qx_refresh_xyz789...",
  "grant_type": "refresh_token"
}

Error Responses

Authentication errors return appropriate HTTP status codes:

StatusDescriptionSolution
401Invalid or missing API keyCheck your API key is correct
403Insufficient permissionsCheck API key scopes
429Rate limit exceededImplement backoff and retry
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key provided",
    "details": "The API key 'qx_live_...' does not exist or has been revoked"
  }
}

Security Best Practices

Recommendations

  • Store API keys in environment variables, never in code
  • Use the minimum required scopes for each key
  • Rotate API keys regularly (every 90 days recommended)
  • Use separate keys for different environments (dev, staging, prod)
  • Revoke compromised keys immediately in the dashboard

Next Steps