Skip to main content

Validate Authentication

Verify an ActionFlows API key via the REST API and retrieve information about the authenticated user and session. Includes the response schema.

Validate Authentication

Verify that your API key is valid and get information about the authenticated user and session.

Endpoint

GET /api/auth/validate

Try it

Live requests run from your browser. Open the API Explorer to try every operation from one screen.

get/api/auth/validate

Validate authentication

Requests go to the live API from your browser. The docs server never sees this key.

curl -X GET 'https://api.actionflows.ai/api/auth/validate' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Accept: application/json'

Response

Send a request to see the response.

Authentication

Required. See API Reference for authentication details.

Response

Success Response (200 OK)

{
  "success": true,
  "data": {
    "authenticated": true,
    "user": {
      "id": "user_123",
      "email": "[email protected]",
      "name": "John Doe"
    },
    "session": {
      "id": "api-key-key_123",
      "expiresAt": "2024-12-31T23:59:59.000Z",
      "activeOrganizationId": null
    }
  }
}

Error Responses

401 Unauthorized

{
  "success": false,
  "error": "Unauthorized",
  "message": "Authentication required",
  "data": {
    "authenticated": false
  }
}

403 Forbidden

{
  "success": false,
  "error": "Access denied",
  "message": "Access denied",
  "data": {
    "authenticated": false
  }
}

429 Too Many Requests

{
  "error": "Too many requests"
}

Example Request

cURL

curl -X GET https://api.actionflows.ai/api/auth/validate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

JavaScript

const response = await fetch('https://api.actionflows.ai/api/auth/validate', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();

if (data.success) {
  console.log('Authenticated as:', data.data.user.email);
} else {
  console.error('Authentication failed:', data.error);
}

Python

import requests

headers = {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
}

response = requests.get('https://api.actionflows.ai/api/auth/validate', headers=headers)
data = response.json()

if data['success']:
    print(f"Authenticated as: {data['data']['user']['email']}")
else:
    print(f"Authentication failed: {data['error']}")

Use Cases

  • Verify API key validity before making other requests
  • Get user information for logging or audit purposes
  • Check session expiration
  • Validate authentication in automated scripts

Notes

  • This endpoint is rate-limited per user
  • The session ID for API keys follows the format api-key-{keyId}
  • activeOrganizationId will be null for API key authentication

On this page