Get started with the Legnext AI API by following these steps to make your first API call.
1. Generate an API Key
Get your API key from the Legnext dashboard to authenticate your requests.
Never share your API key with anyone. Keep it secure and never commit it to version control.
2. Set URL and Endpoint
All API requests are made to our base URL with specific endpoints:
https://api.legnext.ai/api/v1/{endpoint}
For example: https://api.legnext.ai/api/v1/diffusion
All API requests must include the following headers:
| Header | Required | Description |
x-api-key | Yes | Your API key for authentication |
Content-Type | No | Set to application/json |
4. Make Your First API Call
Generate your first image using our text-to-image endpoint:
curl -X POST "https://api.legnext.ai/api/v1/diffusion" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "A beautiful sunset over mountains with vibrant colors",
"callback": "https://your-domain.com/webhook"
}'
All endpoints return a Job object containing:
job_id: Unique job identifier
status: Processing status (pending, processing, completed, failed)
output: Contains result image URLs when completed
meta: Usage and timing information
error: Error details if task failed
6. Next Steps
Start exploring our powerful image generation capabilities!
Important
Please read our Notice before using the API to understand supported models and current limitations.