Create Application
Before using any API services of the Ace Data Cloud platform, you need to create an "Application" for that service. After creating the application, the system will automatically generate an access key for you, which you can use to call the corresponding API.
This interface requires authentication, please refer to Platform Token.
¶ Interface Description
- Request Method: POST
- Request URL:
https://platform.acedata.cloud/api/v1/applications/ - Request Headers:
- accept:
application/json - content-type:
application/json - authorization:
Bearer {token}
- accept:
¶ Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
service_id |
string | Yes | The service ID to apply for (UUID) |
type |
string | No | Application type: Usage (by usage, default), Period (by time period) |
scope |
string | No | Application scope: Individual (default), Global (global) |
¶ CURL Request Example
curl -X POST \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "authorization: Bearer {token}" \
-d '{"service_id": "d87e5e99-b797-4ade-9e73-b896896b0461"}' \
"https://platform.acedata.cloud/api/v1/applications/"
¶ Response Example
{
"id": "107f8d0f-e465-4a7e-a49e-d633d26f7aa2",
"user_id": "b87f67c1-b04f-4332-99a1-7a5e651331c6",
"service_id": "d87e5e99-b797-4ade-9e73-b896896b0461",
"type": "Usage",
"scope": "Individual",
"remaining_amount": 0,
"used_amount": 0,
"paid": false,
"disabled": false,
"allow_consume_global": true,
"expired_at": null,
"credentials": [],
"packages": [],
"service": {
"id": "d87e5e99-b797-4ade-9e73-b896896b0461",
"alias": "midjourney",
"name": "Midjourney"
},
"tags": null,
"metadata": null,
"created_at": "2024-08-01T10:00:00.000000Z",
"updated_at": "2024-08-01T10:00:00.000000Z"
}
After successful creation, you can recharge the quota for this application (by creating an order), and then create a key to call the API.
¶ Notes
- Each user can create multiple applications of different types for the same service.
- If the service has a free quota (
free_amount > 0), the corresponding free quota will be automatically obtained after creating the application. - The global application with
scopeasGlobalcan share its quota across all services (requiresallow_consume_globalto betrue).
¶ Code Example
Python:
import requests
url = "https://platform.acedata.cloud/api/v1/applications/"
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer {token}"
}
data = {
"service_id": "d87e5e99-b797-4ade-9e73-b896896b0461"
}
response = requests.post(url, json=data, headers=headers)
application = response.json()
print(f"Application ID: {application['id']}")
print(f"Remaining Quota: {application['remaining_amount']}")
