Get Key List
A key (Credential) is a credential used to call the Ace Data Cloud API service. Each key is associated with an application, and the token field in the key is used as a Bearer Token for API authentication.
This interface requires authentication. For details, please refer to Platform Token.
¶ Interface Description
- Request Method: GET
- Request URL:
https://platform.acedata.cloud/api/v1/credentials/ - Request Headers:
- accept:
application/json - authorization:
Bearer {token}
- accept:
¶ Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
application_id |
string | No | Filter by application ID |
host |
string | No | Filter by bound domain |
limit |
integer | No | Number of items per page |
offset |
integer | No | Offset |
¶ CURL Request Example
curl -X GET \
-H "accept: application/json" \
-H "authorization: Bearer {token}" \
"https://platform.acedata.cloud/api/v1/credentials/"
Filter by application:
curl -X GET \
-H "accept: application/json" \
-H "authorization: Bearer {token}" \
"https://platform.acedata.cloud/api/v1/credentials/?application_id=107f8d0f-e465-4a7e-a49e-d633d26f7aa2"
¶ Example of Returned Result
{
"count": 3,
"results": [
{
"id": "c1d2e3f4-a5b6-7890-cdef-1234567890ab",
"user_id": "b87f67c1-b04f-4332-99a1-7a5e651331c6",
"application_id": "107f8d0f-e465-4a7e-a49e-d633d26f7aa2",
"type": "Token",
"token": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"username": null,
"password": null,
"host": null,
"limited_amount": null,
"used_amount": 150.5,
"expired_at": null,
"created_at": "2024-06-01T10:00:00.000000Z",
"updated_at": "2024-08-16T07:51:15.603207Z"
}
]
}
¶ Description of Returned Fields
| Field | Type | Description |
|---|---|---|
id |
string | Unique identifier for the key (UUID) |
user_id |
string | User ID |
application_id |
string | Associated application ID |
type |
string | Key type: Token (API key) / Identity (authentication for Proxy service) |
token |
string | API key value (Token type, starts with sk-) |
username |
string | Username (Identity type) |
password |
string | Password (Identity type) |
host |
string | Bound domain (optional) |
limited_amount |
number | Limited usage amount (null indicates unlimited) |
used_amount |
number | Amount used |
expired_at |
string | Expiration time (null indicates never expires) |
¶ Key Type Description
- Token Type: Suitable for general API services. Use the
tokenfield as a Bearer Token to call the API. - Identity Type: Suitable for Proxy services. Use
usernameandpasswordfor authentication.
¶ Code Example
Python:
import requests
url = "https://platform.acedata.cloud/api/v1/credentials/"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}"
}
response = requests.get(url, headers=headers)
data = response.json()
for cred in data["results"]:
if cred["type"] == "Token":
print(f"API Key: {cred['token']}")
print(f" Application ID: {cred['application_id']}")
print(f" Used Amount: {cred['used_amount']}")
elif cred["type"] == "Identity":
print(f"Proxy Account: {cred['username']} / {cred['password']}")
