Skip to main content

Organizations API

The Organizations API allows you to retrieve information about all registered organizations in your Unpod platform.
Prerequisites: Make sure you have your API Token ready. See Authentication for details.

Get All Organizations

Retrieve detailed information of every registered organization, helping you view and manage organizational records in the system.
GET /api/v2/platform/organizations/

Headers

NameTypeRequiredDescription
AuthorizationstringYesAPI Key format: Token <token>

Example Request

GET /api/v2/platform/organizations/
Headers:
  Authorization: Token your-api-token

Success Response (200)

{
  "count": 2,
  "status_code": 200,
  "message": "Organizations fetched successfully",
  "data": [
    {
      "name": "xyz",
      "token": "T6ZN4WQK9JX2BC7LGPR5",
      "domain": "abc.com",
      "domain_handle": "abc.com",
      "is_private_domain": true,
      "role": "viewer"
    }
  ]
}

Response Fields

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

Organization Object Fields

FieldTypeDescription
namestringOrganization name
tokenstringOrganization token
domainstringOrganization domain
domain_handlestringDomain handle for API requests
is_private_domainbooleanWhether the domain is private
rolestringUser’s role: viewer, admin, member

Error Response (401 — Unauthorized)

{
  "status_code": 401,
  "message": "Authentication credentials were not provided."
}

Common Error Codes

Status CodeDescription
200Success - Request completed successfully
401Unauthorized - Invalid or missing API token
403Forbidden - Access denied to the resource
500Internal Server Error - Server-side error

Code Examples

const axios = require('axios');

const headers = {
  'Authorization': 'Token your-api-token'
};

// Get all organizations
const getAllOrganizations = async () => {
  const response = await axios.get(
    'https://unpod.dev/api/v2/platform/organizations/',
    { headers }
  );
  console.log(`Total organizations: ${response.data.count}`);
  return response.data.data;
};

// Example usage
getAllOrganizations();

Best Practices

  1. Org-Handle: Use the domain_handle from this API as the Org-Handle header in other API requests
  2. Caching: Cache organization data to reduce API calls
  3. Error Handling: Always handle potential errors and edge cases
  4. Security: Keep API tokens secure and rotate them regularly