Items
Item/Product management API endpoints
Items API
Manage items in your organization.
Base Path
/api/itemsEndpoints
List Items
List all items in your organization.
GET /api/itemsQuery 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/itemsExample 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 Item
Retrieve a specific item by ID.
GET /api/items/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Item ID |
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/items/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Item not found
Create Item
Create a new item.
POST /api/itemsRequest 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/itemsUpdate Item
Update an existing item.
PUT /api/items/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Item 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/items/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Item not found
Delete Item
Delete a item.
DELETE /api/items/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Item ID |
Example Request:
curl -X DELETE \
-H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/items/123e4567-e89b-12d3-a456-426614174000Example Response:
{
"success": true
}Error Responses:
404 Not Found- Item 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 items
const items = await client.items.list.query();
// Get item
const item = await client.items.get.query({
id: '123e4567-e89b-12d3-a456-426614174000'
});
// Create item
const newItem = await client.items.create.mutate({
status: 'active',
});
// Update item
const updated = await client.items.update.mutate({
id: '123e4567-e89b-12d3-a456-426614174000',
data: {
status: 'inactive',
},
});
// Delete item
await client.items.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 items
response = requests.get(f'{API_BASE}/items', headers=HEADERS)
items = response.json()
# Get item
response = requests.get(
f'{API_BASE}/items/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)
item = response.json()
# Create item
response = requests.post(
f'{API_BASE}/items',
headers=HEADERS,
json={'status': 'active'}
)
new_item = response.json()
# Update item
response = requests.put(
f'{API_BASE}/items/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS,
json={'status': 'inactive'}
)
updated = response.json()
# Delete item
response = requests.delete(
f'{API_BASE}/items/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)