Documents

Where Do I Get an API Key

How to Obtain an API Key in Alchemyst AI

Overview

This document provides a comprehensive guide on how to generate, view, and manage API keys for the Alchemyst AI platform using the available API endpoints.

Table of Contents


Prerequisites

  • Authentication Required: All API key operations require the user to be authenticated. You must include a valid Bearer JWT token in the request headers.

Example header: ```json "Authorization": "Bearer YOUR_JWT_TOKEN" ```


Creating a New API Key

Generate a new API key by making a POST request to:

  • POST /api/v1/settings/api-keys/new

Request Body (optional): You may provide an optional "name" for your API key.

Example Request Body: ```json { "name": "My Integration Key" } ```

Response: ```json { "success": true, "apiKey": "your_generated_api_key", "name": "My Integration Key", "status": 201 } ```


Listing Existing API Keys

Retrieve all API keys associated with your account:

  • GET /api/v1/settings/api-keys/list

Response: ```json { "success": true, "apiKeys": [ { "apiKey": "your_api_key_1", "creator": "user123", "createdAt": "2024-12-24T12:00:00Z" }, ... ] } ```


Deleting an API Key

To delete an API key, send a POST request with the API key you wish to remove:

  • POST /api/v1/settings/api-keys/delete

Request Body: ```json { "apiKey": "your_api_key_to_delete" } ```

Response: ```json { "success": true, "message": "Entry deleted." } ```


Validating API Key Access

To validate that your current authentication allows API key operations and retrieve related organization details, use:

  • GET /api/v1/settings/api-keys/validate

Response: ```json { "user": { /* user information / }, "organization": { / organization details */ } } ```


Endpoint Reference

Endpoint Method Purpose
/api/v1/settings/api-keys/new POST Create a new API key
/api/v1/settings/api-keys/list GET List API keys owned by the authenticated user
/api/v1/settings/api-keys/delete POST Delete a specified API key
/api/v1/settings/api-keys/validate GET Validate API key permissions and fetch details

Notes

  • You must include a valid Bearer JWT token for all the API key endpoints above.
  • API keys are confidential. Do not share them publicly.
  • Only authenticated users can perform these operations. If authentication fails, a 401 Unauthorized response will be returned.

Example: Create and Use an API Key

  1. Authenticate and obtain your Bearer token via a login flow (not included in this document).
  2. Create an API key using /api/v1/settings/api-keys/new.
  3. Use the returned API key to access other endpoints as required.
  4. List or delete your API keys as needed to manage access.