API Overview
The TDMP API provides programmatic access to all platform features. Use it to automate dataset generation, integrate with CI/CD pipelines, manage projects and schemas, and build custom workflows.
Interactive API referenceβ
Explore the full API documentation with an interactive client:
π API Reference
Interactive OpenAPI documentation with request/response examples and a built-in API client for testing endpoints directly in your browser.
Open API Reference βGetting startedβ
Base URLβ
The API base URL depends on your deployment:
- Development:
http://localhost:8010 - Production: Contact your administrator for the correct URL
All endpoints are prefixed with the base URL. For example: http://localhost:8010/users/me
Authenticationβ
The API uses JWT (JSON Web Token) authentication with Bearer tokens.
Step 1: Obtain a token
curl -X POST http://localhost:8010/users/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=your-username&password=your-password"
Response:
{
"access_token": "<token>",
"token_type": "bearer"
}
Step 2: Use the token in requests
Include the token in the Authorization header for all subsequent API calls:
curl http://localhost:8010/users/me \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Token expiration
Tokens expire after 24 hours by default. When a token expires, obtain a new one using the login endpoint.
Request formatβ
HTTP methods: Standard REST methods (GET, POST, PUT, DELETE)
Content type: application/json for request bodies
Request body: JSON format
Example POST request:
curl -X POST http://localhost:8010/projects/create \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My Test Project",
"description": "Automated testing project"
}'
Response formatβ
Content type: application/json
Success responses: HTTP 200 (OK) or 201 (Created)
Error responses: Include status code and error details
Example success response:
{
"project_id": 123,
"name": "My Test Project",
"description": "Automated testing project",
"created_at": "2026-01-06T10:30:00Z"
}
Example error response:
{
"detail": "Project not found"
}
HTTP status codesβ
Success codes:
200 OKβ Request succeeded201 Createdβ Resource created successfully
Client error codes:
400 Bad Requestβ Invalid request data (missing required fields, malformed JSON)401 Unauthorizedβ Missing or invalid authentication token403 Forbiddenβ Insufficient permissions (e.g., Tester trying to delete a project)404 Not Foundβ Resource does not exist422 Unprocessable Entityβ Validation error (e.g., invalid email format, constraint conflicts)
Server error codes:
500 Internal Server Errorβ Unexpected server-side error
API endpoints by categoryβ
Authenticationβ
POST /users/token β Login and obtain access token
Required fields: username, password (form-encoded)
GET /users/me β Get current user information
Returns: id, username, role, tenant_id, projects
GET /users/logout β Logout (invalidates session)
User managementβ
POST /users/create β Create new user (Admin/SuperUser only)
GET /users β Search users in tenant
GET /users/{user_id} β Get user details
PATCH /users/{user_id} β Update user (change role, activate/deactivate)
POST /users/setup-password β Set password using invitation token
Projectsβ
POST /projects/create β Create new project (Manager/Admin/SuperUser)
GET /projects β List all accessible projects
GET /projects/{project_id} β Get project details (members, schemas, datasets)
PUT /projects/{project_id} β Update project name, description, or tags
DELETE /projects/{project_id} β Delete project (Admin only)
POST /projects/{project_id}/add-user β Add member to project
POST /projects/{project_id}/remove-user β Remove member from project
POST /projects/{project_id}/add-schema β Link schema to project
Schemasβ
POST /schemas β Upload new schema (XSD, JSON Schema)
GET /schemas β List schemas in tenant
GET /schemas/{schema_id} β Get schema details
GET /schemas/{schema_id}/repr β Get schema representation for constraint building
DELETE /schemas/{schema_id} β Delete schema
Constraint setsβ
POST /constraints β Create constraint set
GET /constraints β List constraint sets
GET /constraints/{constraint_id} β Get constraint set details
PUT /constraints/{constraint_id} β Update constraint set
DELETE /constraints/{constraint_id} β Delete constraint set
Datasetsβ
POST /datasets/create β Create dataset and trigger generation
Required fields: name, project_id, schema_id, record_count
Optional fields: constraint_set_id, types (output formats), params (generation parameters)
GET /datasets β List all datasets
GET /datasets/{dataset_id} β Get dataset details and status
DELETE /datasets/{dataset_id} β Delete dataset
GET /datasets/generate/{dataset_id} β Manually trigger generation (if queued)
POST /datasets/{dataset_id}/export-s3 β Export dataset to S3 integration
Data (file downloads)β
GET /data/{dataset_id} β Download generated dataset files
Query parameters: format (csv, json, xml, sql), file_index (for multi-file datasets)
Notificationsβ
GET /notifications β Get in-app notifications for current user
DELETE /notifications/{notification_id} β Mark notification as read/delete
GET /notifications/unread-count β Get count of unread notifications
Settingsβ
GET /settings β Get user settings
PUT /settings β Update user profile (name, theme)
POST /settings/avatar β Upload avatar image
POST /settings/change_password β Change password
POST /settings/change_email β Update email address
POST /settings/notifications β Update notification preferences
POST /settings/enable_2fa β Enable two-factor authentication
POST /settings/disable_2fa β Disable two-factor authentication
POST /settings/delete β Delete user account
Audit logsβ
GET /audit/logs β Get audit logs (Admin/SuperUser only)
Query parameters: action, actor_id, role, project_id, start_date, end_date
Tenantsβ
GET /tenants β Get current tenant information
GET /tenants/{tenant_id} β Get tenant details (SuperUser only)
PUT /tenants/{tenant_id} β Update tenant settings (SuperUser only)
Integrationsβ
GET /integrations/providers β List available integration providers
GET /integrations β List configured integrations
POST /integrations β Create new integration
PUT /integrations/{integration_id} β Update integration configuration
DELETE /integrations/{integration_id} β Remove integration
POST /integrations/{integration_id}/test β Test integration connection
Common workflowsβ
Automated dataset generationβ
Typical CI/CD pipeline workflow:
- Authenticate: Obtain API token using service account credentials
- List projects: Find the project ID for your testing project
- Create dataset: POST to
/datasets/createwith schema and constraints - Poll status: GET
/datasets/{id}periodically to check generation status - Download: GET
/data/{id}when status is "completed" - Use in tests: Feed downloaded data into your test framework
Example script (simplified):
#!/bin/bash
TOKEN=$(curl -s -X POST http://localhost:8010/users/token \
-d "username=ci-service&password=$CI_PASSWORD" \
| jq -r '.access_token')
DATASET=$(curl -s -X POST http://localhost:8010/datasets/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "CI Build #'$BUILD_ID'",
"project_id": 5,
"schema_id": 12,
"constraint_set_id": 8,
"record_count": 100,
"types": ["json"]
}' | jq -r '.dataset_id')
# Poll until complete
while true; do
STATUS=$(curl -s http://localhost:8010/datasets/$DATASET \
-H "Authorization: Bearer $TOKEN" \
| jq -r '.status')
if [ "$STATUS" = "completed" ]; then
break
elif [ "$STATUS" = "failed" ]; then
exit 1
fi
sleep 5
done
# Download dataset
curl -o test-data.json http://localhost:8010/data/$DATASET?format=json \
-H "Authorization: Bearer $TOKEN"
Creating and managing projectsβ
# Create project
PROJECT_ID=$(curl -X POST http://localhost:8010/projects/create \
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json" \
-d '{
"name": "Mobile App Testing",
"description": "Test data for mobile app regression suite"
}' | jq -r '.project_id')
# Add team members
curl -X POST http://localhost:8010/projects/$PROJECT_ID/add-user \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"user_id": 42, "role": "edit"}'
# Link schema to project
curl -X POST http://localhost:8010/projects/$PROJECT_ID/add-schema \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"schema_id": 15}'
Bulk operationsβ
Automate repetitive tasks:
import requests
BASE_URL = "http://localhost:8010"
TOKEN = "your-token-here"
HEADERS = {
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json"
}
# Generate multiple datasets
schemas = [10, 11, 12, 13, 14]
project_id = 7
constraint_set_id = 20
for schema_id in schemas:
response = requests.post(
f"{BASE_URL}/datasets/create",
headers=HEADERS,
json={
"name": f"Batch Dataset for Schema {schema_id}",
"project_id": project_id,
"schema_id": schema_id,
"constraint_set_id": constraint_set_id,
"record_count": 50,
"types": ["csv", "json"]
}
)
print(f"Created dataset {response.json()['dataset_id']}")
Rate limiting and best practicesβ
Polling: When checking dataset status, use reasonable intervals (5-10 seconds). Avoid sub-second polling.
Pagination: For list endpoints, use limit and offset query parameters to paginate results (not all endpoints support this yetβcheck interactive docs).
Error handling: Always check HTTP status codes and handle errors gracefully. Log detail field from error responses for debugging.
Token management: Store tokens securely. For CI/CD, use environment variables or secret management tools. Refresh tokens when they expire.
Idempotency: Dataset creation is not idempotentβrepeated calls create new datasets. Use unique naming conventions (e.g., include build ID or timestamp) to track generated datasets.
Concurrency: The API handles concurrent requests. You can generate multiple datasets in parallel, but respect system resources and avoid overwhelming the server.
Role-based accessβ
API endpoints enforce the same role-based permissions as the web interface:
Tester: Can create datasets, view projects they belong to, download data
Manager: Can create projects, manage project members, invite users
Admin: Full tenant management, user administration, access to audit logs
SuperUser: Multi-tenant access, all Admin privileges across all tenants
If you receive a 403 Forbidden error, your role lacks permission for that operation.
Webhooks and event notificationsβ
Some deployments support webhook integrations configured via /integrations:
- dataset.completed: Triggered when dataset generation finishes
- dataset.failed: Triggered when generation fails
- schema.uploaded: Triggered when new schema is added
- project.created: Triggered when new project is created
Configure webhooks in the Integrations page or via the API to receive POST requests at your specified URL.
Troubleshootingβ
"401 Unauthorized": Token is missing, invalid, or expired. Obtain a new token.
"403 Forbidden": Your role lacks permission. Contact an Admin to adjust your permissions.
"404 Not Found": Resource ID is incorrect, or you lack access. Verify the ID and your project membership.
"422 Unprocessable Entity": Validation error. Check the detail field for specific issues (e.g., missing required fields, invalid values).
"500 Internal Server Error": Server-side issue. Check logs or contact support. May indicate constraint conflicts, generation errors, or configuration problems.
Additional resourcesβ
Interactive API docs: /api/reference
Sample scripts: Check your deployment's documentation for language-specific examples (Python, JavaScript, Bash, etc.)
Support: Contact your administrator or refer to internal documentation for deployment-specific details (base URL, service accounts, integration options)