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