Subscription API
This reference documents the Subscription endpoints in the PaiTIENT Secure Model Service REST API, allowing you to manage your account, billing, usage, and subscriptions.
Get Subscription
Retrieves details about your current subscription.
Request
http
GET /v1/subscription
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDResponse
json
{
"id": "sub_12345abcde",
"status": "active",
"plan": "professional",
"billing_cycle": "monthly",
"current_period_start": "2023-11-01T00:00:00Z",
"current_period_end": "2023-12-01T00:00:00Z",
"auto_renew": true,
"created_at": "2023-01-15T00:00:00Z",
"features": {
"max_deployments": 10,
"max_fine_tuning_jobs": 5,
"model_access": ["ZimaBlueAI/HuatuoGPT-o1-8B", "PaiTIENT/ClinicalBERT-8B"],
"private_endpoints": true,
"dedicated_support": true,
"hipaa_compliance": true,
"soc2_compliance": true
},
"limits": {
"requests_per_minute": 900,
"tokens_per_minute": 500000
},
"payment_status": "current"
}Update Subscription
Updates your subscription plan.
Request
http
PATCH /v1/subscription
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDjson
{
"plan": "enterprise",
"billing_cycle": "yearly",
"auto_renew": true
}Response
json
{
"id": "sub_12345abcde",
"status": "updating",
"plan": "enterprise",
"billing_cycle": "yearly",
"current_period_start": "2023-11-01T00:00:00Z",
"current_period_end": "2023-12-01T00:00:00Z",
"next_plan": "enterprise",
"next_billing_cycle": "yearly",
"next_period_start": "2023-12-01T00:00:00Z",
"next_period_end": "2024-12-01T00:00:00Z",
"auto_renew": true,
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-11-10T14:30:00Z",
"features": {
"max_deployments": 10,
"max_fine_tuning_jobs": 5,
"model_access": ["ZimaBlueAI/HuatuoGPT-o1-8B", "PaiTIENT/ClinicalBERT-8B"],
"private_endpoints": true,
"dedicated_support": true,
"hipaa_compliance": true,
"soc2_compliance": true
},
"limits": {
"requests_per_minute": 900,
"tokens_per_minute": 500000
},
"payment_status": "current"
}Cancel Subscription
Cancels your subscription.
Request
http
POST /v1/subscription/cancel
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDjson
{
"reason": "Cost reduction",
"feedback": "Great service, but need to reduce expenses",
"cancel_immediately": false
}Response
json
{
"id": "sub_12345abcde",
"status": "cancelling",
"plan": "professional",
"billing_cycle": "monthly",
"current_period_start": "2023-11-01T00:00:00Z",
"current_period_end": "2023-12-01T00:00:00Z",
"canceled_at": "2023-11-10T14:45:00Z",
"cancel_at_period_end": true,
"auto_renew": false,
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-11-10T14:45:00Z"
}Reactivate Subscription
Reactivates a canceled subscription.
Request
http
POST /v1/subscription/reactivate
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDResponse
json
{
"id": "sub_12345abcde",
"status": "active",
"plan": "professional",
"billing_cycle": "monthly",
"current_period_start": "2023-11-01T00:00:00Z",
"current_period_end": "2023-12-01T00:00:00Z",
"auto_renew": true,
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-11-10T15:00:00Z",
"features": {
"max_deployments": 10,
"max_fine_tuning_jobs": 5,
"model_access": ["ZimaBlueAI/HuatuoGPT-o1-8B", "PaiTIENT/ClinicalBERT-8B"],
"private_endpoints": true,
"dedicated_support": true,
"hipaa_compliance": true,
"soc2_compliance": true
},
"limits": {
"requests_per_minute": 900,
"tokens_per_minute": 500000
},
"payment_status": "current"
}List Plans
Retrieves a list of available subscription plans.
Request
http
GET /v1/subscription/plans
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDResponse
json
{
"plans": [
{
"id": "free",
"name": "Free",
"description": "Basic access for development and testing",
"pricing": {
"monthly": 0,
"yearly": 0
},
"features": {
"max_deployments": 1,
"max_fine_tuning_jobs": 0,
"model_access": ["ZimaBlueAI/HuatuoGPT-o1-8B"],
"private_endpoints": false,
"dedicated_support": false,
"hipaa_compliance": false,
"soc2_compliance": false
},
"limits": {
"requests_per_minute": 60,
"tokens_per_minute": 20000
}
},
{
"id": "basic",
"name": "Basic",
"description": "Starter plan for small projects",
"pricing": {
"monthly": 99,
"yearly": 990
},
"features": {
"max_deployments": 3,
"max_fine_tuning_jobs": 1,
"model_access": ["ZimaBlueAI/HuatuoGPT-o1-8B"],
"private_endpoints": false,
"dedicated_support": false,
"hipaa_compliance": false,
"soc2_compliance": false
},
"limits": {
"requests_per_minute": 300,
"tokens_per_minute": 100000
}
},
{
"id": "professional",
"name": "Professional",
"description": "Advanced features for healthcare organizations",
"pricing": {
"monthly": 499,
"yearly": 4990
},
"features": {
"max_deployments": 10,
"max_fine_tuning_jobs": 5,
"model_access": ["ZimaBlueAI/HuatuoGPT-o1-8B", "PaiTIENT/ClinicalBERT-8B"],
"private_endpoints": true,
"dedicated_support": true,
"hipaa_compliance": true,
"soc2_compliance": true
},
"limits": {
"requests_per_minute": 900,
"tokens_per_minute": 500000
}
},
{
"id": "enterprise",
"name": "Enterprise",
"description": "Customized solutions for large organizations",
"pricing": {
"monthly": "Contact sales",
"yearly": "Contact sales"
},
"features": {
"max_deployments": "Custom",
"max_fine_tuning_jobs": "Custom",
"model_access": ["All models"],
"private_endpoints": true,
"dedicated_support": true,
"hipaa_compliance": true,
"soc2_compliance": true,
"dedicated_infrastructure": true,
"custom_models": true
},
"limits": {
"requests_per_minute": "Custom",
"tokens_per_minute": "Custom"
}
}
]
}Get Usage
Retrieves usage statistics for your account.
Request
http
GET /v1/usage
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDQuery Parameters
| Parameter | Type | Description |
|---|---|---|
start_date | string | Start date in ISO 8601 format (e.g., "2023-11-01") |
end_date | string | End date in ISO 8601 format (e.g., "2023-11-30") |
granularity | string | Data granularity ("daily", "weekly", "monthly", default: "daily") |
Response
json
{
"start_date": "2023-11-01",
"end_date": "2023-11-05",
"granularity": "daily",
"usage": [
{
"date": "2023-11-01",
"api_requests": 1245,
"token_usage": {
"prompt_tokens": 125000,
"completion_tokens": 135000,
"total_tokens": 260000
},
"deployments": {
"active": 3,
"created": 0,
"deleted": 0
},
"fine_tuning": {
"jobs_started": 1,
"jobs_completed": 0,
"training_tokens": 50000
}
},
{
"date": "2023-11-02",
"api_requests": 1356,
"token_usage": {
"prompt_tokens": 132000,
"completion_tokens": 143000,
"total_tokens": 275000
},
"deployments": {
"active": 3,
"created": 0,
"deleted": 0
},
"fine_tuning": {
"jobs_started": 0,
"jobs_completed": 1,
"training_tokens": 25000
}
},
{
"date": "2023-11-03",
"api_requests": 1425,
"token_usage": {
"prompt_tokens": 138000,
"completion_tokens": 148000,
"total_tokens": 286000
},
"deployments": {
"active": 3,
"created": 0,
"deleted": 0
},
"fine_tuning": {
"jobs_started": 0,
"jobs_completed": 0,
"training_tokens": 0
}
},
{
"date": "2023-11-04",
"api_requests": 890,
"token_usage": {
"prompt_tokens": 85000,
"completion_tokens": 92000,
"total_tokens": 177000
},
"deployments": {
"active": 3,
"created": 0,
"deleted": 0
},
"fine_tuning": {
"jobs_started": 0,
"jobs_completed": 0,
"training_tokens": 0
}
},
{
"date": "2023-11-05",
"api_requests": 760,
"token_usage": {
"prompt_tokens": 72000,
"completion_tokens": 79000,
"total_tokens": 151000
},
"deployments": {
"active": 3,
"created": 0,
"deleted": 0
},
"fine_tuning": {
"jobs_started": 0,
"jobs_completed": 0,
"training_tokens": 0
}
}
],
"total": {
"api_requests": 5676,
"token_usage": {
"prompt_tokens": 552000,
"completion_tokens": 597000,
"total_tokens": 1149000
},
"deployments": {
"active": 3,
"created": 0,
"deleted": 0
},
"fine_tuning": {
"jobs_started": 1,
"jobs_completed": 1,
"training_tokens": 75000
}
},
"limits": {
"requests_per_minute": 900,
"tokens_per_minute": 500000
},
"usage_percentage": {
"tokens": 38.3
}
}Get Invoices
Retrieves a list of invoices for your account.
Request
http
GET /v1/billing/invoices
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDQuery Parameters
| Parameter | Type | Description |
|---|---|---|
limit | integer | Maximum number of invoices to return (default: 10, max: 100) |
offset | integer | Offset for pagination (default: 0) |
Response
json
{
"invoices": [
{
"id": "inv_12345abcde",
"amount": 499.00,
"currency": "USD",
"status": "paid",
"billing_period_start": "2023-10-01T00:00:00Z",
"billing_period_end": "2023-10-31T23:59:59Z",
"issue_date": "2023-10-01T00:00:00Z",
"due_date": "2023-10-15T00:00:00Z",
"paid_date": "2023-10-05T09:23:45Z",
"pdf_url": "https://api.paitient.com/v1/billing/invoices/inv_12345abcde/pdf",
"line_items": [
{
"description": "Professional Plan - Monthly",
"amount": 499.00,
"quantity": 1
}
]
},
{
"id": "inv_67890fghij",
"amount": 499.00,
"currency": "USD",
"status": "paid",
"billing_period_start": "2023-09-01T00:00:00Z",
"billing_period_end": "2023-09-30T23:59:59Z",
"issue_date": "2023-09-01T00:00:00Z",
"due_date": "2023-09-15T00:00:00Z",
"paid_date": "2023-09-03T14:12:30Z",
"pdf_url": "https://api.paitient.com/v1/billing/invoices/inv_67890fghij/pdf",
"line_items": [
{
"description": "Professional Plan - Monthly",
"amount": 499.00,
"quantity": 1
}
]
}
],
"pagination": {
"total": 10,
"limit": 2,
"offset": 0,
"next_offset": 2
}
}Update Payment Method
Updates the payment method for your account.
Request
http
POST /v1/billing/payment-method
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDjson
{
"payment_method_token": "pm_12345abcde",
"set_as_default": true
}Response
json
{
"id": "pm_12345abcde",
"type": "credit_card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2025,
"country": "US"
},
"is_default": true,
"created_at": "2023-11-10T16:30:00Z"
}Get Organization
Retrieves details about your organization.
Request
http
GET /v1/organization
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDResponse
json
{
"id": "org_12345abcde",
"name": "Healthcare AI Solutions, Inc.",
"email": "billing@healthcareai.example.com",
"address": {
"line1": "123 Medical Plaza",
"line2": "Suite 456",
"city": "San Francisco",
"state": "CA",
"postal_code": "94107",
"country": "US"
},
"billing_email": "billing@healthcareai.example.com",
"technical_contact": {
"name": "Alex Johnson",
"email": "alex@healthcareai.example.com",
"phone": "+14155551234"
},
"compliance_contact": {
"name": "Sam Chen",
"email": "compliance@healthcareai.example.com",
"phone": "+14155555678"
},
"account_manager": {
"name": "Maya Rodriguez",
"email": "maya.rodriguez@paitient.com",
"phone": "+14155559876"
},
"subscription_id": "sub_12345abcde",
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-10-01T12:30:45Z"
}Update Organization
Updates your organization details.
Request
http
PATCH /v1/organization
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
X-Client-ID: YOUR_CLIENT_IDjson
{
"name": "Healthcare AI Solutions, Inc.",
"email": "info@healthcareai.example.com",
"address": {
"line1": "456 Innovation Drive",
"line2": "Floor 7",
"city": "San Francisco",
"state": "CA",
"postal_code": "94103",
"country": "US"
},
"billing_email": "billing@healthcareai.example.com",
"technical_contact": {
"name": "Alex Johnson",
"email": "alex@healthcareai.example.com",
"phone": "+14155551234"
},
"compliance_contact": {
"name": "Sam Chen",
"email": "compliance@healthcareai.example.com",
"phone": "+14155555678"
}
}Response
json
{
"id": "org_12345abcde",
"name": "Healthcare AI Solutions, Inc.",
"email": "info@healthcareai.example.com",
"address": {
"line1": "456 Innovation Drive",
"line2": "Floor 7",
"city": "San Francisco",
"state": "CA",
"postal_code": "94103",
"country": "US"
},
"billing_email": "billing@healthcareai.example.com",
"technical_contact": {
"name": "Alex Johnson",
"email": "alex@healthcareai.example.com",
"phone": "+14155551234"
},
"compliance_contact": {
"name": "Sam Chen",
"email": "compliance@healthcareai.example.com",
"phone": "+14155555678"
},
"account_manager": {
"name": "Maya Rodriguez",
"email": "maya.rodriguez@paitient.com",
"phone": "+14155559876"
},
"subscription_id": "sub_12345abcde",
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-11-10T16:45:00Z"
}Error Codes
| Code | Description |
|---|---|
invalid_request_error | The request was malformed or missing required parameters |
authentication_error | API key or client ID is invalid or missing |
permission_denied | The API key doesn't have permission to perform the operation |
resource_not_found | The requested resource doesn't exist |
billing_error | Error with payment processing or billing |
rate_limit_exceeded | Too many requests in a given time period |
subscription_error | Error with subscription management |
validation_error | One or more parameters failed validation |
internal_error | An internal error occurred |
Support
For billing, subscription, or payment-related questions, contact:
- Billing Support: billing@paitient.com
- Account Management: accounts@paitient.com
- Phone: +1-415-555-0123 (9 AM - 5 PM PT, Monday - Friday)
For technical support, please refer to our Support Portal or email support@paitient.com.