Space Endpoints

Complete API reference for space management endpoints.

Space endpoints are part of the Admin API tier. All endpoints require API key authentication and are under /api/v1/spaces.

GET /spaces

List all spaces the authenticated user has access to.

curl https://api.tzzl.io/api/v1/spaces \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Returns cursor-paginated results.


GET /spaces/:id

Get space details including access control and security settings.

curl https://api.tzzl.io/api/v1/spaces/SPACE_ID \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Response:

{
  "data": {
    "id": "01HQ...",
    "name": "My App",
    "handle": "a1b2c3",
    "enabled": true,
    "folder_mode": "dynamic",
    "custom_domain": null,
    "webhook_url": null,
    "access_control": { ... },
    "security": { ... },
    "active_upload_config_id": "01HQ..."
  }
}

POST /spaces

Create a new space.

curl -X POST https://api.tzzl.io/api/v1/spaces \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "My App" }'

Parameters:

FieldTypeRequiredValidation
namestringYesUnique across all spaces
descriptionstringNo

A 6-character handle is auto-generated. A default "starter" upload config is created.


PUT /spaces/:id

Update a space.

curl -X PUT https://api.tzzl.io/api/v1/spaces/SPACE_ID \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "Updated Name" }'

Parameters:

FieldTypeRequiredValidation
namestringYesUnique (excluding self)
descriptionstringNo

DELETE /spaces

Delete a space. Requires the space ID as a query parameter.

curl -X DELETE "https://api.tzzl.io/api/v1/spaces?id=SPACE_ID" \
  -H "Authorization: Bearer sk_a1b2c3d4..."

PUT /spaces/:id/access-control

Update space-level access control defaults.

curl -X PUT https://api.tzzl.io/api/v1/spaces/SPACE_ID/access-control \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "access_control": {
      "requires_auth": true,
      "public_read": false
    }
  }'

Parameters:

FieldTypeRequired
access_controlobjectNo
access_control.requires_authbooleanNo
access_control.public_readbooleanNo

DELETE /spaces/:id/access-control

Reset space access control to defaults.

curl -X DELETE https://api.tzzl.io/api/v1/spaces/SPACE_ID/access-control \
  -H "Authorization: Bearer sk_a1b2c3d4..."

PUT /spaces/:id/security

Update space security settings (e.g., watermarking).

curl -X PUT https://api.tzzl.io/api/v1/spaces/SPACE_ID/security \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "security": {
      "watermark": {
        "enabled": true,
        "url": "https://example.com/watermark.png",
        "position": "southeast",
        "opacity": 0.5
      }
    }
  }'

DELETE /spaces/:id/security

Reset space security to defaults.

curl -X DELETE https://api.tzzl.io/api/v1/spaces/SPACE_ID/security \
  -H "Authorization: Bearer sk_a1b2c3d4..."

POST /spaces/:id/api-keys

Generate a new API key for the space.

curl -X POST https://api.tzzl.io/api/v1/spaces/SPACE_ID/api-keys \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "production" }'

Response:

{
  "data": {
    "id": 1,
    "name": "production",
    "key": "sk_...",
    "type": "space",
    "space_id": "01HQ...",
    "is_active": true
  }
}

GET /spaces/:id/api-keys

List all API keys for a space.

curl https://api.tzzl.io/api/v1/spaces/SPACE_ID/api-keys \
  -H "Authorization: Bearer sk_a1b2c3d4..."

DELETE /spaces/:id/api-keys/:keyId

Revoke an API key.

curl -X DELETE https://api.tzzl.io/api/v1/spaces/SPACE_ID/api-keys/KEY_ID \
  -H "Authorization: Bearer sk_a1b2c3d4..."