Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DUVAN100/saludya-api/llms.txt

Use this file to discover all available pages before exploring further.

This is the API specification for SaludYa. The implementation is currently under development.

Introduction

The SaludYa API is a RESTful API specification designed for comprehensive medical appointment management. Built with a layered architecture, it provides robust endpoints for managing appointments, patients, doctors, and schedules.

Base URL

All API endpoints are relative to the base URL:
https://api.saludya.com/v1

Versioning

The API uses URL-based versioning. The current version is v1, which is included in the base URL path. Breaking changes will result in a new version (e.g., v2).

Authentication

All API requests require authentication using Bearer tokens in the Authorization header:
Authorization: Bearer your_access_token_here

Standard Headers

Required Headers

HeaderValueDescription
AuthorizationBearer {token}Authentication token
Content-Typeapplication/jsonRequest payload format

Optional Headers

HeaderValueDescription
Accept-Languagees, enPreferred response language
X-Request-IDUUIDUnique identifier for request tracing

Common Request Parameters

Query Parameters

Many endpoints support these common query parameters:
ParameterTypeDescription
pageintegerPage number for pagination (default: 1)
limitintegerItems per page (default: 20, max: 100)
sortstringSort field (prefix with - for descending)
filterstringFilter expression for resource filtering

Example Paginated Request

GET /appointments?page=2&limit=50&sort=-createdAt

Response Format

All API responses follow a consistent JSON structure.

Successful Response

{
  "success": true,
  "data": {
    "id": "apt_1234567890",
    "type": "appointment",
    "attributes": {
      "patientId": "pat_abc123",
      "doctorId": "doc_xyz789",
      "scheduledAt": "2026-03-15T10:00:00Z",
      "status": "confirmed"
    }
  },
  "meta": {
    "timestamp": "2026-03-06T12:00:00Z",
    "requestId": "req_unique_id"
  }
}

Paginated Response

{
  "success": true,
  "data": [
    {
      "id": "apt_001",
      "type": "appointment",
      "attributes": { }
    }
  ],
  "meta": {
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 150,
      "totalPages": 8
    },
    "timestamp": "2026-03-06T12:00:00Z"
  }
}

Error Response

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": [
      {
        "field": "scheduledAt",
        "message": "Date must be in the future"
      }
    ]
  },
  "meta": {
    "timestamp": "2026-03-06T12:00:00Z",
    "requestId": "req_unique_id"
  }
}

HTTP Status Codes

Status CodeDescription
200 OKRequest succeeded
201 CreatedResource created successfully
204 No ContentRequest succeeded with no response body
400 Bad RequestInvalid request parameters
401 UnauthorizedMissing or invalid authentication
403 ForbiddenAuthenticated but not authorized
404 Not FoundResource not found
409 ConflictRequest conflicts with current state
422 Unprocessable EntityValidation error
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer error
503 Service UnavailableService temporarily unavailable

Error Codes

Common error codes returned by the API:
CodeDescription
AUTHENTICATION_REQUIREDMissing authentication token
INVALID_TOKENInvalid or expired token
VALIDATION_ERRORRequest validation failed
RESOURCE_NOT_FOUNDRequested resource does not exist
DUPLICATE_RESOURCEResource already exists
SCHEDULE_CONFLICTAppointment time conflicts with existing booking
RATE_LIMIT_EXCEEDEDToo many requests
INTERNAL_ERRORInternal server error

Rate Limiting

The API implements rate limiting to ensure fair usage:
  • Default limit: 1000 requests per hour per API key
  • Burst limit: 100 requests per minute
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1709730000

API Resources

Explore the different resource groups available in the SaludYa API:

Appointments

Create, retrieve, update, and cancel medical appointments

Patients

Manage patient profiles and medical information

Doctors

Access doctor profiles, specialties, and availability

Schedules

Manage doctor schedules and available time slots

Example: Complete Request Flow

Here’s a complete example of creating an appointment:

Request

curl -X POST https://api.saludya.com/v1/appointments \
  -H "Authorization: Bearer your_access_token" \
  -H "Content-Type: application/json" \
  -H "X-Request-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "patientId": "pat_abc123",
    "doctorId": "doc_xyz789",
    "scheduledAt": "2026-03-15T10:00:00Z",
    "reason": "Annual checkup",
    "notes": "Patient prefers morning appointments"
  }'

Response

{
  "success": true,
  "data": {
    "id": "apt_1234567890",
    "type": "appointment",
    "attributes": {
      "patientId": "pat_abc123",
      "doctorId": "doc_xyz789",
      "scheduledAt": "2026-03-15T10:00:00Z",
      "status": "confirmed",
      "reason": "Annual checkup",
      "notes": "Patient prefers morning appointments",
      "createdAt": "2026-03-06T12:00:00Z",
      "updatedAt": "2026-03-06T12:00:00Z"
    },
    "relationships": {
      "patient": {
        "data": { "type": "patient", "id": "pat_abc123" }
      },
      "doctor": {
        "data": { "type": "doctor", "id": "doc_xyz789" }
      }
    }
  },
  "meta": {
    "timestamp": "2026-03-06T12:00:00Z",
    "requestId": "550e8400-e29b-41d4-a716-446655440000"
  }
}

Best Practices

  1. Use Request IDs: Include X-Request-ID header for debugging and tracking
  2. Handle Rate Limits: Implement exponential backoff when rate limited
  3. Validate Before Sending: Validate data client-side to reduce errors
  4. Use Pagination: Always use pagination for list endpoints
  5. Cache Responses: Cache GET responses where appropriate
  6. Handle Errors Gracefully: Implement proper error handling for all error codes
  7. Use HTTPS: Always use HTTPS for secure communication
  8. Keep Tokens Secure: Never expose API tokens in client-side code

SDK and Libraries

Official SDKs are available for popular programming languages:
  • JavaScript/TypeScript: npm install @saludya/api-client
  • Python: pip install saludya-api
  • Java: maven: com.saludya:api-client
  • PHP: composer require saludya/api-client

Support

For API support and questions:

Build docs developers (and LLMs) love