> For the complete documentation index, see [llms.txt](https://therappai.gitbook.io/therappai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://therappai.gitbook.io/therappai-docs/documentation/getting-started/environments.md).

# Environments

Base URLs (production, staging), rate limits, versioning.

The therappai API is designed to be predictable and easy to integrate. This page outlines the available environments, base URLs, versioning model, and any rate-limiting considerations so you can develop confidently.

***

### **Base URLs**

#### **Production**

Use this environment for all live traffic:

```
https://api.therappai.com/api/v1
```

This endpoint is optimized for performance, reliability, and user-facing workloads.

***

#### **Staging (optional)**

If your team sets up a staging or sandbox API, it would typically follow this structure:

```
https://staging.therappai.com/api/v1
```

> **Note:** Staging is not required for v1. If you do not have this environment set up yet, you may remove or comment it out.

***

### **API Versioning**

therappai uses **URL-based versioning**, starting with:

```
/api/v1
```

#### Why URL versioning?

* Non-breaking changes can be shipped continuously
* Breaking changes are isolated to new versions
* Integrators always know which version they are targeting

When a future version ships, it will follow this pattern:

```
/api/v2
```

Versioning ensures your integration remains stable over time.

***

### **Rate Limits**

To protect platform stability, therappai may apply soft rate limits to some endpoints, especially those related to:

* AI therapy message generation
* Video avatar generation
* Heavy content retrieval

#### Defaults (if nothing custom is set):

* Standard API endpoints: **high allowance**
* AI message endpoints: **moderate allowance**
* Video endpoints: **tighter allowance**

> **Note:** If your application expects high concurrency or enterprise-scale usage, reach out to us for custom limits.

***

### **Error Behavior Between Environments**

Production and staging (if enabled) share consistent error formats:

* `400` — validation issues
* `401` — authentication required or invalid token
* `403` — forbidden
* `404` — resource not found
* `429` — rate limit reached
* `500` — server error

This consistency ensures that development and testing behave predictably.

***

### **Environment Best Practices**

* Always store base URLs in environment variables (`ENV`, `.env`, CI/CD secrets).
* Never hardcode tokens in your codebase or client-side JavaScript.
* Test integrations in staging when available, especially session flows and multi-step interactions.
* Lock your integration to a specific API version.

***
