Spaces
Get Space by Token
Retrieve configuration and metadata of a specific space by its token
GET
/
api
/
v2
/
platform
/
spaces
/
{space_token}
/
Get Space by Token
curl --request GET \
--url https://unpod.ai/api/v2/platform/spaces/{space_token}/ \
--header 'Authorization: <api-key>' \
--header 'Org-Handle: <org-handle>'import requests
url = "https://unpod.ai/api/v2/platform/spaces/{space_token}/"
headers = {
"Org-Handle": "<org-handle>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Org-Handle': '<org-handle>', Authorization: '<api-key>'}
};
fetch('https://unpod.ai/api/v2/platform/spaces/{space_token}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://unpod.ai/api/v2/platform/spaces/{space_token}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Org-Handle: <org-handle>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://unpod.ai/api/v2/platform/spaces/{space_token}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Org-Handle", "<org-handle>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://unpod.ai/api/v2/platform/spaces/{space_token}/")
.header("Org-Handle", "<org-handle>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://unpod.ai/api/v2/platform/spaces/{space_token}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Org-Handle"] = '<org-handle>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status_code": 200,
"message": "Space fetched successfully",
"data": {
"id": "sp_001",
"name": "Sales Outreach Q1",
"token": "8KZRTQP7BNW5XEDLORYUHMJC",
"agent_handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
"created_at": "2026-01-10T08:00:00Z"
}
}
{
"status_code": 404,
"message": "Space not found."
}
{
"status_code": 401,
"message": "Authentication credentials were not provided."
}
{
"status_code": 200,
"message": "Space fetched successfully",
"data": {
"id": "sp_001",
"name": "Sales Outreach Q1",
"token": "8KZRTQP7BNW5XEDLORYUHMJC",
"agent_handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
"created_at": "2026-01-10T08:00:00Z"
}
}
{
"status_code": 404,
"message": "Space not found."
}
{
"status_code": 401,
"message": "Authentication credentials were not provided."
}
Get Space by Token
Retrieve configuration and metadata of a specific space identified by its token. This allows you to view a space’s current setup, properties, and organization context.Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | API Key format: Token <token> |
| Org-Handle | string | Yes | Organization domain handle |
Response Fields
| Field | Type | Description |
|---|---|---|
| status_code | integer | HTTP status code |
| message | string | Response message |
| data | object | Space object details |
Space Object Fields
| Field | Type | Description |
|---|---|---|
| id | string | Unique space identifier |
| name | string | Space display name |
| token | string | Public token for API access |
| agent_handle | string | Handle of the agent assigned to this space |
| created_at | string | Space creation timestamp (ISO 8601) |
Common Error Codes
| Status Code | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 400 | Bad Request - Invalid parameters provided |
| 401 | Unauthorized - Invalid or missing API token |
| 403 | Forbidden - Access denied to the resource |
| 404 | Not Found - Space or Organization not found |
| 500 | Internal Server Error - Server-side error |
Code Examples
const axios = require('axios');
const headers = {
'Authorization': 'Token your-api-token',
'Org-Handle': 'your-org-handle'
};
// Get space by token
const getSpaceByToken = async (spaceToken) => {
const response = await axios.get(
`https://unpod.ai/api/v2/platform/spaces/${spaceToken}/`,
{ headers }
);
console.log(`Space name: ${response.data.data.name}`);
console.log(`Agent handle: ${response.data.data.agent_handle}`);
return response.data.data;
};
// Example usage
getSpaceByToken('8KZRTQP7BNW5XEDLORYUHMJC');
import requests
headers = {
'Authorization': 'Token your-api-token',
'Org-Handle': 'your-org-handle'
}
def get_space_by_token(space_token: str):
"""Get a specific space by its token"""
url = f'https://unpod.ai/api/v2/platform/spaces/{space_token}/'
response = requests.get(url, headers=headers)
data = response.json()
print(f"Space name: {data['data']['name']}")
print(f"Agent handle: {data['data']['agent_handle']}")
return data['data']
# Example usage
get_space_by_token('8KZRTQP7BNW5XEDLORYUHMJC')
# Get space by token
curl -X GET "https://unpod.ai/api/v2/platform/spaces/8KZRTQP7BNW5XEDLORYUHMJC/" \
-H "Authorization: Token your-api-token" \
-H "Org-Handle: your-org-handle"
Best Practices
- Space Token: Ensure you are using a valid space token from your organization
- Org-Handle: Always include the correct organization handle in requests
- Error Handling: Handle 404 responses when a space token may have been deleted or is invalid
- Security: Keep API tokens secure and rotate them regularly
- Caching: Consider caching space details to avoid repeated lookups for the same space
Was this page helpful?
⌘I
Get Space by Token
curl --request GET \
--url https://unpod.ai/api/v2/platform/spaces/{space_token}/ \
--header 'Authorization: <api-key>' \
--header 'Org-Handle: <org-handle>'import requests
url = "https://unpod.ai/api/v2/platform/spaces/{space_token}/"
headers = {
"Org-Handle": "<org-handle>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Org-Handle': '<org-handle>', Authorization: '<api-key>'}
};
fetch('https://unpod.ai/api/v2/platform/spaces/{space_token}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://unpod.ai/api/v2/platform/spaces/{space_token}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Org-Handle: <org-handle>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://unpod.ai/api/v2/platform/spaces/{space_token}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Org-Handle", "<org-handle>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://unpod.ai/api/v2/platform/spaces/{space_token}/")
.header("Org-Handle", "<org-handle>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://unpod.ai/api/v2/platform/spaces/{space_token}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Org-Handle"] = '<org-handle>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status_code": 200,
"message": "Space fetched successfully",
"data": {
"id": "sp_001",
"name": "Sales Outreach Q1",
"token": "8KZRTQP7BNW5XEDLORYUHMJC",
"agent_handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
"created_at": "2026-01-10T08:00:00Z"
}
}
{
"status_code": 404,
"message": "Space not found."
}
{
"status_code": 401,
"message": "Authentication credentials were not provided."
}