Organizations
Organization management API endpoints
Organizations API
Manage organizations in your organization.
Base Path
/api/organizationsEndpoints
List Organizations
List all organizations in your organization.
GET /api/organizationsQuery Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
includeInactive | boolean | No | Include inactive records in the results |
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/organizationsExample Response:
[
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "org_123",
"status": "active",
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}
]Get Organization
Retrieve a specific organization by ID.
GET /api/organizations/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Organization ID |
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/organizations/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Organization not found
Create Organization
Create a new organization.
POST /api/organizationsRequest Body:
{
"status": "active"
}Example Request:
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "active"}' \
https://api.glapi.io/api/organizationsUpdate Organization
Update an existing organization.
PUT /api/organizations/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Organization ID |
Request Body:
Provide only the fields you want to update. All fields are optional.
{
"status": "inactive"
}Example Request:
curl -X PUT \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "inactive"}' \
https://api.glapi.io/api/organizations/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Organization not found
Delete Organization
Delete a organization.
DELETE /api/organizations/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Organization ID |
Example Request:
curl -X DELETE \
-H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/organizations/123e4567-e89b-12d3-a456-426614174000Example Response:
{
"success": true
}Error Responses:
404 Not Found- Organization not found
Code Examples
TypeScript
import { createTRPCClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '@glapi/trpc';
const client = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: 'https://api.glapi.io/api/trpc',
headers: () => ({
Authorization: `Bearer ${process.env.GLAPI_TOKEN}`,
}),
}),
],
});
// List organizations
const items = await client.organizations.list.query();
// Get organization
const item = await client.organizations.get.query({
id: '123e4567-e89b-12d3-a456-426614174000'
});
// Create organization
const newItem = await client.organizations.create.mutate({
status: 'active',
});
// Update organization
const updated = await client.organizations.update.mutate({
id: '123e4567-e89b-12d3-a456-426614174000',
data: {
status: 'inactive',
},
});
// Delete organization
await client.organizations.delete.mutate({
id: '123e4567-e89b-12d3-a456-426614174000'
});Python
import requests
import os
API_BASE = 'https://api.glapi.io/api'
TOKEN = os.environ.get('GLAPI_TOKEN')
HEADERS = {
'Authorization': f'Bearer {TOKEN}',
'Content-Type': 'application/json',
}
# List organizations
response = requests.get(f'{API_BASE}/organizations', headers=HEADERS)
items = response.json()
# Get organization
response = requests.get(
f'{API_BASE}/organizations/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)
item = response.json()
# Create organization
response = requests.post(
f'{API_BASE}/organizations',
headers=HEADERS,
json={'status': 'active'}
)
new_item = response.json()
# Update organization
response = requests.put(
f'{API_BASE}/organizations/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS,
json={'status': 'inactive'}
)
updated = response.json()
# Delete organization
response = requests.delete(
f'{API_BASE}/organizations/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)