> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mycura.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Cura API Reference

> The Cura AI API provides endpoints for integrating healthcare AI capabilities into your applications. All endpoints are RESTful and return JSON responses. 

## Base URL

All API requests should be made to:

```
https://api.mycura.org/api/cura
```

The base API URL is `https://api.mycura.org`.

## Authentication

All API endpoints require authentication using an API key. Include your API key in the request headers:

```bash theme={null}
X-API-Key: YOUR_API_KEY
```

Or as a query parameter:

```bash theme={null}
?api_key=YOUR_API_KEY
```

Learn more about [authentication](/authentication).

## Response Format

All API responses follow a consistent format:

### Success Response

```json theme={null}
{
  "success": true,
  "response": "AI generated response text",
  "patient": { /* patient object when applicable */ }
}
```

### Error Response

```json theme={null}
{
  "success": false,
  "error": "Error message describing what went wrong"
}
```

## Available Endpoints

<CardGroup cols={1}>
  <Card title="POST /chat" icon="comments" href="/api-reference/endpoint/chat">
    Generate AI responses with patient context and conversation history
  </Card>

  <Card title="GET /patients/{id}" icon="user" href="/api-reference/endpoint/get-patient">
    Retrieve patient information by ID
  </Card>

  <Card title="POST /patients" icon="user-plus" href="/api-reference/endpoint/create-patient">
    Create a new patient record with health information
  </Card>
</CardGroup>

## OpenAPI Specification

Access the complete OpenAPI specification at:

```
https://api.mycura.org/api/cura/openapi.json
```

<Card title="Download OpenAPI Spec" icon="download" href="/api-reference/openapi.json">
  Import into Postman, Insomnia, or generate client libraries
</Card>

## Error Codes

| Status Code | Description                                                   |
| ----------- | ------------------------------------------------------------- |
| 200         | Success - Request completed successfully                      |
| 201         | Created - Resource created successfully (patient creation)    |
| 400         | Bad Request - Invalid or missing required parameters          |
| 401         | Unauthorized - Invalid or missing API key                     |
| 404         | Not Found - Resource doesn't exist                            |
| 409         | Conflict - Duplicate resource (e.g., patient with same phone) |
| 500         | Internal Server Error - An unexpected error occurred          |
