API Keys#

API key management for cloud instances

List Antfly Cloud management API keys#

GET/organizations/{org_id}/cloud/api-keys

List organization-scoped Antfly Cloud management API keys

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Code Examples#

curl -X GET "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/api-keys" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "organization_id": "550e8400-e29b-41d4-a716-446655440000",
      "created_by_user_id": "550e8400-e29b-41d4-a716-446655440000",
      "cloud_instance_id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "antflydb_abc123",
      "key_scope": "instance",
      "key_prefix_type": "antflydb",
      "name": "Production API Key",
      "key_type": "read_only",
      "status": "active",
      "created_at": "2025-10-02T15:30:00Z",
      "last_used_at": "2025-10-02T15:30:00Z",
      "expires_at": "2025-10-02T15:30:00Z",
      "quota_queries_per_month": 0,
      "allowed_tables": [
        "string"
      ],
      "allowed_operations": [
        "string"
      ],
      "row_filter": {},
      "grants": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "organization_id": "550e8400-e29b-41d4-a716-446655440000",
          "cloud_instance_id": "550e8400-e29b-41d4-a716-446655440000",
          "subject_type": "user",
          "subject_id": "550e8400-e29b-41d4-a716-446655440000",
          "table_name": "string",
          "actions": [
            "string"
          ],
          "row_filter": {},
          "row_filter_template": {},
          "metadata": {},
          "created_by": "550e8400-e29b-41d4-a716-446655440000",
          "created_at": "2025-10-02T15:30:00Z",
          "updated_at": "2025-10-02T15:30:00Z"
        }
      ],
      "management_scopes": [
        "string"
      ],
      "hosted_inference_limits": {
        "requests_per_minute": 0,
        "tokens_per_minute": 0,
        "concurrent_requests": 0,
        "managed_spend_cents_per_month": 0
      },
      "browser_access": true
    }
  ]
}

Create Antfly Cloud management API key#

POST/organizations/{org_id}/cloud/api-keys

Create an organization-scoped antfly_cloud_* key for Antfly Cloud management API calls

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID

Request Body#

{
  "name": "Antfly Cloud CLI",
  "scopes": [
    "string"
  ],
  "expires_at": "2025-10-02T15:30:00Z",
  "hosted_inference_limits": {
    "requests_per_minute": 0,
    "tokens_per_minute": 0,
    "concurrent_requests": 0,
    "managed_spend_cents_per_month": 0
  }
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/api-keys" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Antfly Cloud CLI",
"scopes": [
  "string"
],
"expires_at": "2025-10-02T15:30:00Z",
"hosted_inference_limits": {
  "requests_per_minute": 0,
  "tokens_per_minute": 0,
  "concurrent_requests": 0,
  "managed_spend_cents_per_month": 0
}
}'

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "key": "antflydb_abc123_sk_live_xxxxxxxxxxxxxxxxxxxxx",
  "key_prefix": "antflydb_abc123",
  "name": "string",
  "key_type": "read_only",
  "browser_access": true
}

Update Antfly Cloud management API key#

PATCH/organizations/{org_id}/cloud/api-keys/{key_id}

Update mutable settings for an organization-scoped antfly_cloud_* management API key

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
key_idstringpathYesAPI key ID

Request Body#

{
  "hosted_inference_limits": {
    "requests_per_minute": 0,
    "tokens_per_minute": 0,
    "concurrent_requests": 0,
    "managed_spend_cents_per_month": 0
  }
}

Code Examples#

curl -X PATCH "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/api-keys/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"hosted_inference_limits": {
  "requests_per_minute": 0,
  "tokens_per_minute": 0,
  "concurrent_requests": 0,
  "managed_spend_cents_per_month": 0
}
}'

Responses#

No response body

Revoke Antfly Cloud management API key#

DELETE/organizations/{org_id}/cloud/api-keys/{key_id}

Revoke an organization-scoped antfly_cloud_* management API key

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
key_idstringpathYesAPI key ID

Code Examples#

curl -X DELETE "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/api-keys/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

No response body

List cloud API keys#

GET/organizations/{org_id}/cloud/instances/{instance_id}/api-keys

List API keys for a cloud instance

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
instance_idstringpathYesCloud instance ID

Code Examples#

curl -X GET "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/instances/550e8400-e29b-41d4-a716-446655440000/api-keys" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "organization_id": "550e8400-e29b-41d4-a716-446655440000",
      "created_by_user_id": "550e8400-e29b-41d4-a716-446655440000",
      "cloud_instance_id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "antflydb_abc123",
      "key_scope": "instance",
      "key_prefix_type": "antflydb",
      "name": "Production API Key",
      "key_type": "read_only",
      "status": "active",
      "created_at": "2025-10-02T15:30:00Z",
      "last_used_at": "2025-10-02T15:30:00Z",
      "expires_at": "2025-10-02T15:30:00Z",
      "quota_queries_per_month": 0,
      "allowed_tables": [
        "string"
      ],
      "allowed_operations": [
        "string"
      ],
      "row_filter": {},
      "grants": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "organization_id": "550e8400-e29b-41d4-a716-446655440000",
          "cloud_instance_id": "550e8400-e29b-41d4-a716-446655440000",
          "subject_type": "user",
          "subject_id": "550e8400-e29b-41d4-a716-446655440000",
          "table_name": "string",
          "actions": [
            "string"
          ],
          "row_filter": {},
          "row_filter_template": {},
          "metadata": {},
          "created_by": "550e8400-e29b-41d4-a716-446655440000",
          "created_at": "2025-10-02T15:30:00Z",
          "updated_at": "2025-10-02T15:30:00Z"
        }
      ],
      "management_scopes": [
        "string"
      ],
      "hosted_inference_limits": {
        "requests_per_minute": 0,
        "tokens_per_minute": 0,
        "concurrent_requests": 0,
        "managed_spend_cents_per_month": 0
      },
      "browser_access": true
    }
  ]
}

Create cloud API key#

POST/organizations/{org_id}/cloud/instances/{instance_id}/api-keys

Create a new API key for accessing the cloud instance

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
instance_idstringpathYesCloud instance ID

Request Body#

{
  "name": "Production API Key",
  "key_type": "read_only",
  "expires_at": "2025-10-02T15:30:00Z",
  "quota_queries_per_month": 0,
  "grants": [
    {
      "table_name": "string",
      "actions": [
        "string"
      ],
      "row_filter": {},
      "row_filter_template": {},
      "metadata": {}
    }
  ],
  "hosted_inference_limits": {
    "requests_per_minute": 0,
    "tokens_per_minute": 0,
    "concurrent_requests": 0,
    "managed_spend_cents_per_month": 0
  },
  "browser_access": true
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/instances/550e8400-e29b-41d4-a716-446655440000/api-keys" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key",
"key_type": "read_only",
"expires_at": "2025-10-02T15:30:00Z",
"quota_queries_per_month": 0,
"grants": [
  {
    "table_name": "string",
    "actions": [
      "string"
    ],
    "row_filter": {},
    "row_filter_template": {},
    "metadata": {}
  }
],
"hosted_inference_limits": {
  "requests_per_minute": 0,
  "tokens_per_minute": 0,
  "concurrent_requests": 0,
  "managed_spend_cents_per_month": 0
},
"browser_access": true
}'

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "key": "antflydb_abc123_sk_live_xxxxxxxxxxxxxxxxxxxxx",
  "key_prefix": "antflydb_abc123",
  "name": "string",
  "key_type": "read_only",
  "browser_access": true
}

Update cloud API key#

PATCH/organizations/{org_id}/cloud/instances/{instance_id}/api-keys/{key_id}

Update mutable settings for an instance-scoped antflydb_* API key

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
instance_idstringpathYesCloud instance ID
key_idstringpathYesAPI key ID

Request Body#

{
  "hosted_inference_limits": {
    "requests_per_minute": 0,
    "tokens_per_minute": 0,
    "concurrent_requests": 0,
    "managed_spend_cents_per_month": 0
  }
}

Code Examples#

curl -X PATCH "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/instances/550e8400-e29b-41d4-a716-446655440000/api-keys/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"hosted_inference_limits": {
  "requests_per_minute": 0,
  "tokens_per_minute": 0,
  "concurrent_requests": 0,
  "managed_spend_cents_per_month": 0
}
}'

Responses#

No response body

Revoke cloud API key#

DELETE/organizations/{org_id}/cloud/instances/{instance_id}/api-keys/{key_id}

Revoke an API key for a cloud instance

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
instance_idstringpathYesCloud instance ID
key_idstringpathYesAPI key ID

Code Examples#

curl -X DELETE "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/instances/550e8400-e29b-41d4-a716-446655440000/api-keys/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

No response body

Rotate cloud API key#

POST/organizations/{org_id}/cloud/instances/{instance_id}/api-keys/{key_id}/rotate

Revoke the existing key and create a new one with the same name and permissions

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
instance_idstringpathYesCloud instance ID
key_idstringpathYesAPI key ID

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/instances/550e8400-e29b-41d4-a716-446655440000/api-keys/550e8400-e29b-41d4-a716-446655440000/rotate" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "key": "antflydb_abc123_sk_live_xxxxxxxxxxxxxxxxxxxxx",
  "key_prefix": "antflydb_abc123",
  "name": "string",
  "key_type": "read_only",
  "browser_access": true
}

Rotate Antfly Cloud management API key#

POST/organizations/{org_id}/cloud/api-keys/{key_id}/rotate

Atomically revoke an antfly_cloud_* key and create a replacement with the same scopes

Parameters#

NameTypeLocationRequiredDescription
org_idstringpathYesOrganization ID
key_idstringpathYesAPI key ID

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/organizations/550e8400-e29b-41d4-a716-446655440000/cloud/api-keys/550e8400-e29b-41d4-a716-446655440000/rotate" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "key": "antflydb_abc123_sk_live_xxxxxxxxxxxxxxxxxxxxx",
  "key_prefix": "antflydb_abc123",
  "name": "string",
  "key_type": "read_only",
  "browser_access": true
}