Skip to main content
GET
/
api
/
v2
/
platform
/
spaces
Get All Spaces
curl --request GET \
  --url http://localhost:3001/api/v2/platform/spaces/ \
  --header 'Authorization: <api-key>' \
  --header 'Org-Handle: <org-handle>'
{
  "count": 207,
  "status_code": 200,
  "message": "Spaces fetched successfully",
  "data": [
    {
      "id": "sp_001",
      "name": "Sales Outreach Q1",
      "token": "8KZAMRAHSXXXXXXMAYNASMJC",
      "agent_handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
      "created_at": "2026-01-10T08:00:00Z"
    }
  ]
}
{
  "count": 207,
  "status_code": 200,
  "message": "Spaces fetched successfully",
  "data": [
    {
      "id": "sp_001",
      "name": "Sales Outreach Q1",
      "token": "8KZAMRAHSXXXXXXMAYNASMJC",
      "agent_handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
      "created_at": "2026-01-10T08:00:00Z"
    }
  ]
}

Get All Spaces

Retrieve a list of all spaces within your organization. Spaces are containers that organize your tasks, runs, and data collections.

Headers

NameTypeRequiredDescription
AuthorizationstringYesAPI Key format: Token <token>
Org-HandlestringYesOrganization domain handle

Response Fields

FieldTypeDescription
countintegerTotal number of spaces
status_codeintegerHTTP status code
messagestringResponse message
dataarrayArray of space objects

Space Object Fields

FieldTypeDescription
idstringUnique space identifier
namestringSpace display name
tokenstringPublic token for API access (use as space_token)
agent_handlestringHandle of the agent assigned to the space
created_atstringSpace creation timestamp (ISO 8601)

Common Error Codes

Status CodeDescription
200Success - Request completed successfully
400Bad Request - Invalid parameters provided
401Unauthorized - Invalid or missing API token
403Forbidden - Access denied to the resource
404Not Found - Organization not found
500Internal Server Error - Server-side error

Code Examples

const axios = require('axios');

const headers = {
  'Authorization': 'Token your-api-token',
  'Org-Handle': 'your-org-handle'
};

// Get all spaces
const getAllSpaces = async () => {
  const response = await axios.get(
    'https://unpod.dev/api/v2/platform/spaces/',
    { headers }
  );
  console.log(`Total spaces: ${response.data.count}`);
  response.data.data.forEach(space => {
    console.log(`${space.name} - Token: ${space.token}`);
  });
  return response.data.data;
};

// Example usage
getAllSpaces();

Best Practices

  1. Org-Handle: Always include the correct organization handle in your requests
  2. Space Token: Note the token field — it is used as the space_token path parameter in other endpoints
  3. Agent Handle: Use the agent_handle when creating tasks to assign them to the correct agent
  4. Error Handling: Always handle potential errors and edge cases
  5. Caching: Consider caching space data to reduce API calls since spaces change infrequently

Authorizations

Authorization
string
header
required

Format: Token

Headers

Org-Handle
string
required

Organization domain handle

Example:

"unpod"

Response

List of all spaces