ZenZap Members API
Operations for retrieving organization members
Operations for retrieving organization members
openapi: 3.0.3
info:
title: Zenzap External Integration Agentic Members API
description: "API for external applications to integrate with Zenzap.\n## Getting Started\nWelcome to the Zenzap External Integration API documentation. This API is used to integrate with Zenzap.\nAs a context we would like to familiarize you with the Zenzap platform and how it works.\nZenzap is a platform for creating and managing topics and messages.\nTopics (Zenzap term for group chats/channels/conversations) are used to create and manage conversations with your team. Topics are used to group messages and tasks together.\nMessages are used to send and receive messages with your team.\nTasks are used to create and manage tasks with your team.\nMembers are used to manage your team members.\nAPI keys are used to authenticate your requests to the Zenzap API.\nAPI keys are created and managed by the Zenzap admin user.\n\nWhen you create a new API key, it would create a new bot user in Zenzap, on which behalf you can send messages, create topics, create tasks and manage members.\nAll actions you perform with the API key will be performed on behalf of the bot user.\nThe bot can be used within the scope of your organization. You can create topics, send messages, create tasks and manage members on behalf of the bot.\n1. On a Zenzap admin user, go to https://app.zenzap.co/console\n2. Create a new API key with the needed permissions\n3. Copy the API key and secret from the API key settings\n4. For each request:\n - Add the Authorization header with your API key\n - Generate a Unix timestamp in milliseconds\n - Calculate the HMAC-SHA256 signature:\n - For POST/PUT/PATCH/DELETE: Sign `{timestamp}.{body}`\n - For GET: Sign `{timestamp}.{uri}` (e.g., `/v2/members?limit=10`)\n - Add the X-Signature header with the hex-encoded signature\n - Add the X-Timestamp header with the timestamp used in the payload\n\n## Authentication\nAll API endpoints require two forms of authentication:\n\n1. **Bearer Token**: Include your API key in the Authorization header:\n```\nAuthorization: Bearer YOUR_API_KEY\n```\n\n2. **Request Signing**: Include an HMAC signature and timestamp in headers:\n```\nX-Signature: <HMAC-SHA256 hex-encoded signature>\nX-Timestamp: <Unix timestamp in milliseconds>\n```\nThe signature includes a timestamp for replay protection. Requests older than 5 minutes are rejected.\n\nThe signature payload differs by HTTP method:\n- **POST/PUT/PATCH/DELETE requests**: Sign `{timestamp}.{body}`\n- **GET requests**: Sign `{timestamp}.{uri}`\n\nThe signature is calculated using HMAC-SHA256 with your API secret.\n\n **How to calculate:**\n 1. Get the current Unix timestamp in milliseconds\n 2. Determine the payload:\n - **POST/PUT/PATCH/DELETE**: Use `{timestamp}.{body}` (e.g., `1699564800000.{\"topicId\":\"123\"}`)\n - **GET**: Use `{timestamp}.{uri}` (e.g., `1699564800000./v2/members?limit=10`)\n 3. Calculate HMAC-SHA256 of the payload using your API secret\n 4. Hex-encode the result (64 character lowercase string)\n 5. Include timestamp in X-Timestamp header\n\n **Example (Python):**\n ```python\n import json\n import hmac\n import hashlib\n import time\n import requests\n\n def create_topic(name: str, members: list[str], description: str = None, external_id: str = None) -> dict:\n \"\"\"Create a topic in Zenzap with HMAC signature and replay protection.\"\"\"\n\n # Build request body\n body = {\n \"name\": name,\n \"members\": members,\n }\n if description:\n body[\"description\"] = description\n if external_id:\n body[\"externalId\"] = external_id\n\n # Serialize body (no spaces for consistent signing)\n body_json = json.dumps(body, separators=(\",\", \":\"))\n\n # Get timestamp for replay protection\n timestamp = int(time.time() * 1000) # Unix milliseconds\n\n # Create HMAC-SHA256 signature with timestamp\n signature_payload = f\"{timestamp}.{body_json}\"\n signature = hmac.new(\n API_SECRET.encode(),\n signature_payload.encode(),\n hashlib.sha256\n ).hexdigest()\n\n # Make request\n headers = {\n \"Authorization\": f\"Bearer {API_KEY}\",\n \"Content-Type\": \"application/json\",\n \"X-Signature\": signature,\n \"X-Timestamp\": str(timestamp),\n }\n\n response = requests.post(f\"{BASE_URL}/v2/topics\", headers=headers, data=body_json)\n response.raise_for_status()\n return response.json()\n ```\n\n **Note:** Our API documentation tools cannot automatically generate HMAC signatures. You will need to calculate this manually or use a tool like Postman with pre-request scripts.\n\n\n## Rate Limits\nAPI requests are rate limited per organization. Contact support for specific limits.\n"
version: 2.0.0
contact:
name: Zenzap Support
url: https://zenzap.co/support
servers:
- url: https://api.zenzap.co
description: Production server
security:
- bearerAuth: []
hmacSignature: []
- oauth2ClientCredentials: []
tags:
- name: Members
description: Operations for retrieving organization members
paths:
/v2/members:
get:
summary: List members
description: 'Get a paginated list of all members in your organization. Only returns active members.
Pagination:
- `limit`: default `50`, max `100`
- `cursor`: opaque cursor from the previous response (`nextCursor`)
'
operationId: listMembers
security:
- bearerAuth: []
hmacSignature: []
- oauth2ClientCredentials:
- member:read
tags:
- Members
parameters:
- $ref: '#/components/parameters/XSignature'
- $ref: '#/components/parameters/XTimestamp'
- name: limit
in: query
description: 'Maximum number of members to return (default: 50, max: 100)'
required: false
schema:
type: integer
format: int64
minimum: 1
maximum: 100
default: 50
- name: cursor
in: query
description: Opaque cursor from a previous `nextCursor` value.
required: false
schema:
type: string
- name: emails
in: query
description: Comma-separated list of email addresses to filter members (e.g., john@example.com,jane@example.com)
required: false
schema:
type: string
example: john@example.com,jane@example.com
responses:
'200':
description: Members list retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/MembersListResponse'
example:
members:
- id: 550e8400-e29b-41d4-a716-446655440001
name: John Doe
email: john@example.com
phone: '+1234567890'
externalId: emp-001
createdAt: 1699564800000
updatedAt: 1699564800000
status: Active
- id: 550e8400-e29b-41d4-a716-446655440002
name: Jane Smith
email: jane@example.com
phone: '+1234567891'
createdAt: 1699564800000
updatedAt: 1699564800000
status: Active
nextCursor: eyJ0IjoxNjk5NTY0ODAwMDAwLCJpZCI6InVANTUwZTg0MDAtZTI5Yi00MWQ0LWE3MTYtNDQ2NjU1NDQwMDAyIn0.abc123
hasMore: true
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
/v2/members/me:
get:
summary: Get current member
description: 'Get information about the member associated with the current API key (the bot itself).
'
operationId: getCurrentMember
security:
- bearerAuth: []
hmacSignature: []
- oauth2ClientCredentials:
- member:read
tags:
- Members
parameters:
- $ref: '#/components/parameters/XSignature'
- $ref: '#/components/parameters/XTimestamp'
responses:
'200':
description: Member information retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/MemberResponse'
example:
id: b@660e8400-e29b-41d4-a716-446655440003
name: API Bot
email: bot@example.com
phone: ''
createdAt: 1699564800000
updatedAt: 1699564800000
status: Active
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
components:
parameters:
XSignature:
name: X-Signature
in: header
required: false
description: "HMAC signature of the request for authentication and replay protection.\n\n**Required only when authenticating with a static API key.** If you are using an OAuth access token (issued by `POST /oauth/token`), omit this header — the JWT carries all the authentication and integrity guarantees.\n\n**Replay Protection:** The signature includes a timestamp to prevent replay attacks.\nRequests with timestamps older than 5 minutes are rejected.\n\nThe signature payload differs by HTTP method:\n- **POST/PUT/PATCH/DELETE**: HMAC-SHA256 of `{timestamp}.{body}`\n- **GET**: HMAC-SHA256 of `{timestamp}.{uri}`\n\nThe signature is calculated as:\n1. Get the current Unix timestamp in milliseconds\n2. Determine the payload:\n - For POST/PUT/PATCH/DELETE: Use `{timestamp}.{body}` where body is the request body\n - For GET: Use `{timestamp}.{uri}` where uri is the full request URI (e.g., `/v2/members?limit=10`)\n3. Calculate HMAC-SHA256 of the combined payload using your API secret\n4. Hex-encode the output\n5. Include the timestamp in the `X-Timestamp` header\n\nExample for GET request to `/v2/members?limit=10`:\n```\ntimestamp = 1699564800000\npayload = \"1699564800000./v2/members?limit=10\"\nsignature = HMAC-SHA256(secret, payload)\nX-Signature: hex(signature)\nX-Timestamp: 1699564800000\n```\n\nExample for POST request with body `{\"topicId\":\"123\",\"text\":\"Hello\"}`:\n```\ntimestamp = 1699564800000\npayload = '1699564800000.{\"topicId\":\"123\",\"text\":\"Hello\"}'\nsignature = HMAC-SHA256(secret, payload)\nX-Signature: hex(signature)\nX-Timestamp: 1699564800000\n```\n\nFor `multipart/form-data` requests, sign the exact raw request body bytes\n(including boundaries and file bytes) as transmitted.\n"
schema:
type: string
pattern: ^[a-f0-9]{64}$
example: a3d5f8e7c2b1d4f6a8e9c7b5d3f1a2e4b6c8d0f2e4a6b8c0d2e4f6a8b0c2d4e6
XTimestamp:
name: X-Timestamp
in: header
required: false
description: 'Unix timestamp in milliseconds when the request was created.
Used for replay protection — requests older than 5 minutes are rejected.
**Required only when authenticating with a static API key.** Omit when using an OAuth access token.
'
schema:
type: integer
format: int64
example: 1699564800000
schemas:
MemberResponse:
type: object
properties:
id:
type: string
description: The member ID
example: 550e8400-e29b-41d4-a716-446655440001
name:
type: string
description: The member's name
example: John Doe
email:
type: string
format: email
description: The member's email address
example: john@example.com
phone:
type: string
description: The member's phone number
example: '+1234567890'
externalId:
type: string
description: Optional external identifier if set by your integration
example: emp-001
createdAt:
type: integer
format: int64
description: Unix timestamp in milliseconds when the member was created
example: 1699564800000
updatedAt:
type: integer
format: int64
description: Unix timestamp in milliseconds when the member was last updated
example: 1699564800000
status:
type: string
description: The member's status
enum:
- Pending
- Active
- Deleted
- Archived
example: Active
MembersListResponse:
type: object
properties:
members:
type: array
items:
$ref: '#/components/schemas/MemberResponse'
description: Array of member objects
nextCursor:
type: string
description: Cursor for the next page. Omitted when there are no more results.
hasMore:
type: boolean
description: Whether there are more members available.
responses:
Unauthorized:
description: Unauthorized - invalid or missing API token
content:
text/plain:
schema:
type: string
example: unauthorized
InternalServerError:
description: Internal server error
content:
text/plain:
schema:
type: string
example: internal server error
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'Bearer token for the request. Two flavors:
- **Static API key** — pass your API key (the value returned as `apiKey` when the bot was created). Must be paired with `X-Signature` + `X-Timestamp` (the `hmacSignature` scheme).
- **OAuth access token** — pass the JWT returned by `POST /oauth/token`. No signature headers are required.
'
hmacSignature:
type: apiKey
in: header
name: X-Signature
description: 'HMAC-SHA256 signature for request verification. Required **only** when authenticating with a static API key. Omit when using an OAuth access token.
'
oauth2ClientCredentials:
type: oauth2
description: 'OAuth 2.0 `client_credentials` grant for API-key bots. Use the `clientId` and `clientSecret` returned when the bot was created (or rotated) to mint short-lived access tokens. See [Authentication](/api-reference/authentication) for details.
Access tokens are bearer JWTs and expire after 1 hour. There is no refresh token — re-mint with the client credentials when the token expires.
'
flows:
clientCredentials:
tokenUrl: https://api.zenzap.co/oauth/token
scopes:
channel:list: List topics the bot belongs to
channel:read: Read topic metadata
channel:write: Create/update topics and manage members
message:read: Read messages
message:send: Send messages
message:write: Edit / delete / mark-delivered / mark-read messages
reaction:write: Add and remove reactions on messages
task:read: Read tasks
task:write: Create / update / delete tasks
poll:write: Create polls and cast / retract votes
member:read: List organization members
updates:read: Long-poll for outbound events