Goatlab API Docs

Create a new space

POST
/v1/spaces

This endpoint allows you to create a new space within a tenant.

Scoped Requests (External Systems): When using a scoped API key, the endpoint automatically handles tenant and user provisioning:

  • If the tenant doesn't exist, it will be created automatically
  • If the user doesn't exist, it will be created and assigned to the tenant

Non-Scoped Requests: When using a non-scoped API key:

  • Both the tenant and user must already exist in the system
  • Returns 404 if either the tenant or user is not found

Authorization

ApiTokenAuth PRODUCT
x-api-key<token>

API Key with role based permission

In: header

Scope: PRODUCT

Header Parameters

x-user-id*string

The ID of the user creating the space

x-tenant-id*string

The ID of the tenant owning the space

Request Body

application/json

The space data to create

TypeScript Definitions

Use the request body type in TypeScript.

Request body for creating a new space

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/spaces" \  -H "x-user-id: string" \  -H "x-tenant-id: string" \  -H "Content-Type: application/json" \  -d '{    "name": "Product Development",    "description": "Space for tracking product development activities",    "type": "PROJECT",    "visibility": "PRIVATE"  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Product Development",
  "description": "Space for tracking product development activities",
  "type": "PROJECT",
  "visibility": "PRIVATE",
  "ownerId": "user-123",
  "tenantId": "tenant-456",
  "fileCount": 0,
  "lastUpload": null,
  "createdAt": "2025-12-30T10:30:00.000Z",
  "updatedAt": "2025-12-30T10:30:00.000Z"
}
{
  "message": "string"
}
{
  "message": "Invalid API Key"
}

{
  "message": "Tenant with id tenant-123 does not exist"
}

{
  "message": "Internal Server Error"
}