Skip to main content
GET
/
api
/
v2
/
platform
/
organizations
Get Organizations
curl --request GET \
  --url http://localhost:3001/api/v2/platform/organizations/ \
  --header 'Authorization: <api-key>' \
  --header 'Org-Handle: <org-handle>'
{
  "count": 3,
  "status_code": 200,
  "message": "Organizations fetched successfully",
  "data": [
    {
      "id": 1,
      "name": "Unpod TV",
      "domain_handle": "unpod.tv",
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": 2,
      "name": "Recalll",
      "domain_handle": "recalll.co",
      "created_at": "2024-03-20T08:00:00Z"
    }
  ]
}
{
  "count": 3,
  "status_code": 200,
  "message": "Organizations fetched successfully",
  "data": [
    {
      "id": 1,
      "name": "Unpod TV",
      "domain_handle": "unpod.tv",
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": 2,
      "name": "Recalll",
      "domain_handle": "recalll.co",
      "created_at": "2024-03-20T08:00:00Z"
    }
  ]
}

Organizations API

Retrieve a list of all organizations associated with your API token. The domain_handle field in the response is used as the Org-Handle header in subsequent API requests.

Response Fields

FieldTypeDescription
countintegerTotal number of organizations
status_codeintegerHTTP status code
messagestringResponse message
dataarrayArray of organization objects

Organization Object Fields

FieldTypeDescription
idintegerUnique organization identifier
namestringOrganization display name
domain_handlestringDomain handle used as Org-Handle in API requests
created_atstringOrganization 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 organizations
const getOrganizations = async () => {
  const response = await axios.get(
    'https://unpod.dev/api/v2/platform/organizations/',
    { headers }
  );
  console.log(`Total organizations: ${response.data.count}`);
  response.data.data.forEach(org => {
    console.log(`${org.name} - Handle: ${org.domain_handle}`);
  });
  return response.data.data;
};

// Example usage
getOrganizations();

Best Practices

  1. Org-Handle: Use the domain_handle from the response as the Org-Handle header in all subsequent requests
  2. Caching: Cache organization data locally to reduce API calls since organizations change infrequently
  3. Error Handling: Always handle potential errors and edge cases
  4. Security: Keep API tokens secure and rotate them regularly
  5. Multiple Orgs: If you have access to multiple organizations, store all handles and switch between them as needed

Authorizations

Authorization
string
header
required

Format: Token

Headers

Org-Handle
string
required

Organization domain handle

Example:

"unpod"

Response

List of organizations