Create an API key.
Scope it to a project with project_id, which requires read access to that
project; omit it for a key that reaches every project you can read. A
project-scoped or agent key cannot create an API key. The response carries
the secret in redacted_api_key, and only this once.
Create Api Key
import os
from llama_cloud_admin import LlamaCloudAdmin
client = LlamaCloudAdmin(
api_key=os.environ.get("LLAMA_CLOUD_API_KEY"), # This is the default and can be omitted
)
api_key = client.api_keys.create()
print(api_key.id){
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"redacted_api_key": "redacted_api_key",
"user_id": "user_id",
"created_at": "2019-12-27T18:11:19.117Z",
"expires_at": "2019-12-27T18:11:19.117Z",
"key_type": "agent",
"metadata": {
"foo": "bar"
},
"name": "name",
"project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"role": "admin",
"updated_at": "2019-12-27T18:11:19.117Z"
}Returns Examples
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"redacted_api_key": "redacted_api_key",
"user_id": "user_id",
"created_at": "2019-12-27T18:11:19.117Z",
"expires_at": "2019-12-27T18:11:19.117Z",
"key_type": "agent",
"metadata": {
"foo": "bar"
},
"name": "name",
"project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"role": "admin",
"updated_at": "2019-12-27T18:11:19.117Z"
}