API Documentation

Authentication

All API endpoints require authentication using an API key. Include your API key in the Authorization header of your requests:

Authorization: Bearer YOUR_API_KEY

Managing API Keys

To create a new API key:

  1. Log in to your FastVoice AI account
  2. Navigate to the API Keys section
  3. Click on "Create New API Key"
  4. Enter a name for your key (e.g., "Development", "Production")
  5. Copy and securely store your API key - it won't be shown again

API Key Properties

  • Each key is unique and cannot be recovered if lost
  • Keys can be enabled or disabled at any time
  • You can set an optional expiration date for each key
  • The system tracks the last time each key was used

Endpoints

Generate Voice

Generate a new voice audio from text.

POST /api/v1/voices/generate

Request Body Parameters

{
  "characterId": "string",    // Required: ID of the character voice to use
  "text": "string",          // Required: Text to convert to speech (1-1000 characters)
  "webhookUrl": "string",    // Optional: URL to notify when processing is complete
  "exaggeration": 0.25,      // Optional: Voice expression level (0.0-1.0, default: 0.25)
  "temperature": 0.7,        // Optional: Voice variation (0.1-1.0, default: 0.7)
  "cfgWeight": 0.5          // Optional: How closely to match the reference (0.1-1.0, default: 0.5)
}

Detailed Parameter Descriptions:

  • characterId: The unique identifier of the voice character to use. Get available characters from your dashboard.
  • text: The text content to convert to speech. Must be between 1 and 1000 characters.
  • webhookUrl: If provided, we'll send a POST request to this URL when the job completes.
  • exaggeration: Controls how exaggerated the voice expression is. Higher values create more dramatic speech.
  • temperature: Controls randomness in the voice generation. Higher values create more varied outputs.
  • cfgWeight: Controls how closely the output matches the reference voice. Higher values create more faithful but potentially less natural speech.

Response

{
  "jobId": "string"       // ID to track the generation job status
}

Check Job Status

Check the status of a voice generation job.

GET /api/v1/voices/jobs/{jobId}/status

Response

{
  "status": "pending" | "done" | "error",  // Current job status
  "url": "string"                          // URL to download the audio file (when status is "done")
}

Status Values:

  • pending: The job is queued or currently processing
  • done: The job has completed successfully and the audio is ready
  • error: The job failed to process

Webhook Notifications

If you provided a webhookUrl, you'll receive a POST request with the following body when the job completes:

{
  "jobId": "string",
  "status": "done" | "error",
  "url": "string"           // Included only when status is "done"
}

Error Responses

401 Unauthorized

{
  "error": "Unauthorized"  // Invalid or missing API key
}

404 Not Found

{
  "error": "Resource not found"  // Invalid job ID or character ID
}

400 Bad Request

{
  "error": "Invalid request parameters",
  "details": {
    "field": "Description of the error"
  }
}

429 Too Many Requests

{
  "error": "Rate limit exceeded"  // Too many requests or insufficient credits
}