Get Application Details

By using the application ID, you can obtain detailed information about a specific application, including remaining quota, used quota, associated keys, and packages, etc.

This interface requires authentication, for details please refer to Platform Token.

Interface Description

  • Request Method: GET
  • Request URL: https://platform.acedata.cloud/api/v1/applications/{application_id}/
  • Request Headers:
    • accept: application/json
    • authorization: Bearer {token}

Where {application_id} is the UUID of the application.

CURL Request Example

curl -X GET \
  -H "accept: application/json" \
  -H "authorization: Bearer {token}" \
  "https://platform.acedata.cloud/api/v1/applications/107f8d0f-e465-4a7e-a49e-d633d26f7aa2/"

Response Result 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": 493.221,
  "used_amount": 21.779,
  "paid": true,
  "disabled": false,
  "allow_consume_global": true,
  "expired_at": null,
  "credentials": [
    {
      "id": "c1d2e3f4-a5b6-7890-cdef-1234567890ab",
      "token": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "type": "Token",
      "host": null,
      "limited_amount": null,
      "used_amount": 0,
      "expired_at": null
    }
  ],
  "packages": [
    {
      "id": "pkg-uuid",
      "name": "500 Times Package",
      "type": "Usage",
      "price": 49.99,
      "amount": 500
    }
  ],
  "service": {
    "id": "d87e5e99-b797-4ade-9e73-b896896b0461",
    "alias": "midjourney",
    "name": "Midjourney"
  },
  "tags": null,
  "metadata": null,
  "created_at": "2024-05-30T14:41:20.052849Z",
  "updated_at": "2024-08-16T07:51:15.603207Z"
}

Response Field Description

Field Type Description
id string Application ID
remaining_amount number Remaining quota (this is the most commonly used field for monitoring balance)
used_amount number Used quota
paid boolean Whether it has been paid
disabled boolean Whether it has been disabled
credentials array Associated key information
packages array Purchased package information
service object Service information

Applicable Scenarios

This interface is commonly used for:

  1. Monitoring Remaining Quota: Regularly check remaining_amount and recharge in time when the quota is insufficient.
  2. Viewing Key Information: Obtain associated API keys (credentials).
  3. Viewing Consumption Situation: Understand total consumption through used_amount.

Code Example

Python:

import requests

application_id = "107f8d0f-e465-4a7e-a49e-d633d26f7aa2"
url = f"https://platform.acedata.cloud/api/v1/applications/{application_id}/"
headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}"
}

response = requests.get(url, headers=headers)
app = response.json()

print(f"Service: {app['service']['name']}")
print(f"Remaining Quota: {app['remaining_amount']}")
print(f"Used Quota: {app['used_amount']}")
print(f"Number of Keys: {len(app['credentials'])}")