Textos API Documentation
This document describes the Textos REST API. All endpoints are prefixed with /api/v1 unless otherwise noted.
Authentication
The API uses JWT (JSON Web Token) for authentication. Include the access token in the Authorization header:
Obtaining Tokens
Login
Request:
Response:
Refresh Token
Response:
Using API Keys
For programmatic access, you can use API keys instead of JWT tokens. Include the API key in the X-API-Key header:
Authentication Endpoints
Register with Invitation
Register a new user using an invitation token.
Request:
{
"token": "invitation-token",
"password": "secure-password",
"name": "John Doe",
"language": "fr"
}
Get Current User
Returns the authenticated user's profile.
Update Current User
Request:
Forgot Password
Request:
Reset Password
Request:
OAuth Providers
Returns list of enabled OAuth providers for the current domain.
SMS & Conversations
Send SMS
Request:
Response:
{
"message": {
"id": "...",
"direction": "outbound",
"status": "sent",
"body": "Hello from Textos!",
"from_number": "+15149876543",
"to_number": "+15141234567",
"created_at": "2024-01-15T10:30:00Z"
},
"conversation": { ... }
}
List Conversations
Query Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| team_id | string | Filter by team |
| status | string | open or closed |
| skip | integer | Pagination offset |
| limit | integer | Results per page (max 100) |
Get Conversation
Returns conversation details with messages.
Query Parameters: | Parameter | Type | Description | |-----------|------|-------------| | skip | integer | Message pagination offset | | limit | integer | Messages per page (max 100) |
Close Conversation
Reopen Conversation
List Messages
Query Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| team_id | string | Filter by team |
| direction | string | inbound or outbound |
| status | string | Message status |
| skip | integer | Pagination offset |
| limit | integer | Results per page |
Teams
List Teams
Returns teams accessible to the current user.
Get Team
Create Team
Request:
Update Team
Request:
{
"name": "Updated Team Name",
"phone_number": "+15149876543",
"business_hours": [
{ "day": 0, "start": "09:00", "end": "17:00" },
{ "day": 1, "start": "09:00", "end": "17:00" }
],
"outside_hours_behavior": "queue",
"auto_reply_message": "We're currently closed...",
"welcome_message": "Thank you for contacting us!",
"timezone": "America/Montreal"
}
Delete Team
Update Business Hours
Request:
{
"business_hours": [
{ "day": 0, "start": "09:00", "end": "17:00" },
{ "day": 1, "start": "09:00", "end": "17:00" },
{ "day": 2, "start": "09:00", "end": "17:00" },
{ "day": 3, "start": "09:00", "end": "17:00" },
{ "day": 4, "start": "09:00", "end": "17:00" }
],
"outside_hours_behavior": "queue",
"auto_reply_message": "We're currently closed. We'll respond during business hours.",
"timezone": "America/Montreal"
}
Notes:
- Day 0 = Monday, 6 = Sunday
- outside_hours_behavior: queue or reject
- auto_reply_message: optional, sent when SMS received outside hours (for both behaviors)
Team Members
List Members
Add Member
Request:
Remove Member
Team Phone Numbers
Regenerate Webhook
Organizations
My Organizations
Returns all organizations the current user belongs to.
Switch Organization
Request:
Current Organization
Update Current Organization
Request:
Organization Members
Invitations
List Invitations
Create Invitation
Request:
Response includes token for the invitation URL.
Delete Invitation
Verify Invitation (Public)
API Keys
List API Keys
Create API Key
Request:
Response includes key field - save it as it's only shown once!
Get API Key
Revoke API Key
orMetrics
Overview
Query Parameters: | Parameter | Type | Description | |-----------|------|-------------| | team_id | string | Filter by team (admin only) | | start_date | string | ISO date | | end_date | string | ISO date | | days | integer | Days to look back (default 30) |
Volume
Query Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| team_id | string | Filter by team |
| start_date | string | ISO date |
| end_date | string | ISO date |
| days | integer | Days to look back |
| granularity | string | hour, day, week, or month |
Performance
Team Metrics
User Metrics
Export Metrics
Webhooks
These endpoints are called by SMS providers to deliver incoming messages.
Receive SMS (Team)
The secret_token is the team's webhook secret.
Receive SMS (Domain)
provider:ubityorisp_telecomsecret_token: Domain's webhook secret
Message Status Update
Admin Endpoints (Super Admin Only)
Organizations
List All Organizations
Create Organization
Request:
Get Organization
Notes: - Super admins can access any organization - Organization admins can only access their own organization
Get Organization Invitations
Notes: - Super admins can access any organization - Organization admins can only access their own organization
Update Organization
Delete Organization
Update Organization Member
Request:
Delete Organization Member
Domains
List Domains
Create Domain
Request:
{
"name": "my-domain",
"hostnames": ["app.example.com", "app.example.com:8080"],
"display_name": "My Domain"
}
Get Domain
Update Domain
Delete Domain
Get Current Domain (Public)
Domain Settings
SMTP Settings
OAuth Settings
GET /api/v1/domains/{domain_id}/settings/oauth
PUT /api/v1/domains/{domain_id}/settings/oauth/{provider}
SMS Providers
GET /api/v1/domains/{domain_id}/sms-providers
PUT /api/v1/domains/{domain_id}/sms-providers/{provider}
Domain Phone Numbers
List Phone Numbers
Create Phone Number(s)
Request (batch):
Update Phone Number
Configure Provider
Request:
Assign to Organization
Request:
Delete Phone Number
Domain Webhooks
Domain SMS Logs
Query Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| direction | string | inbound or outbound |
| provider | string | Filter by provider |
| start_date | string | ISO date |
| end_date | string | ISO date |
| skip | integer | Pagination offset |
| limit | integer | Results per page (max 100) |
Error Responses
All errors follow this format:
Common error codes:
- validation_error - Invalid request data
- unauthorized - Authentication required
- forbidden - Insufficient permissions
- not_found - Resource not found
- send_failed - SMS sending failed
- provider_error - SMS provider error
Rate Limits
| Endpoint | Limit |
|---|---|
| POST /auth/login | 20/minute |
| POST /auth/register | 10/hour |
| POST /auth/forgot-password | 5/hour |
| POST /auth/reset-password | 10/hour |
| POST /sms/send | 100/hour |
Roles & Permissions
| Role | Description |
|---|---|
super_admin |
Full system access, can manage all domains and organizations |
admin |
Organization administrator, can manage teams and members |
manager |
Team manager, can configure team settings and view metrics |
agent |
Can handle conversations assigned to their team |