Programmatically Managing Your WesenAI Account
A developer-focused guide to using the WesenAI Management API for key generation, usage tracking, and more.
While you can manage your account from the WesenAI dashboard, we also provide a powerful Management API that lets you automate and integrate these features directly into your own systems. This guide will walk you through the available endpoints and how to use them.
Getting Started
Before you start, here's what you need to know:
- Base URL: All Management API endpoints are available under
https://management.api.wesen.ai
. - Authentication: Just like our other services, you'll need to authenticate your requests using an API key. You can check out our Authentication Guide for more details.
Exploring the Endpoints
Service Information
You can use these endpoints to get general information about the API and its current status.
GET /v1
: Returns basic information about the Management API.GET /v1/health
: A simple health check endpoint that lets you know if the service is up and running.
Managing Your API Keys
These endpoints allow you to programmatically manage your API keys.
POST /v1/keys
: Creates a new API key for your account. This is useful for automating key rotation or provisioning keys for new services.GET /v1/keys
: Retrieves a list of all the API keys associated with your account.DELETE /v1/keys/{keyId}
: Deletes a specific API key. Remember, once a key is deleted, it's gone for good.
Monitoring Usage
If you want to build your own monitoring or analytics tools, you can use these endpoints to get detailed usage data.
GET /v1/usage
: Fetches a detailed log of your usage records.GET /v1/usage/by-service
: Returns your usage data, aggregated by service (e.g., Chat, TTS).GET /v1/usage/by-date
: Gives you usage data, aggregated by date.GET /v1/usage/statistics
: Provides a summary of your usage statistics, which is great for a quick overview.