HomeKnowledge BaseAPI & Integrations
API & Integrations

API: Getting Started

Introduction to the MedCompliance API for developers.

MedCompliance Team
8 min read
Updated January 10, 2025

API: Getting Started

Build powerful integrations with the MedCompliance REST API.

Overview

MedCompliance API allows developers to:

  • Retrieve inspection data programmatically
  • Create and manage appointments
  • Export compliance reports
  • Integrate with EMR/EHR systems
  • Automate workflows
  • API Version: v1

    Base URL: https://api.medcompliance.com/v1

    Format: JSON

    Authentication: API Key (Bearer token)

    Prerequisites

    Requirements:

  • Enterprise subscription
  • Admin or System Admin role
  • Basic REST API knowledge
  • HTTP client (Postman, curl, etc.)
  • Getting Your API Key

    Generate API Key:

    1. Log in as Admin

    2. Navigate to Settings → API

    3. Click "Generate New API Key"

    4. Copy key immediately (shown once)

    5. Store securely

    API Key Format:

    `

    med_live_1234567890abcdefghijklmnop

    `

    Security:

  • Never commit API keys to code
  • Use environment variables
  • Rotate keys quarterly
  • Revoke compromised keys immediately
  • Making Your First Request

    Authentication

    Include API key in header:

    `bash

    curl -H "Authorization: Bearer YOUR_API_KEY" \

    https://api.medcompliance.com/v1/inspections

    `

    List Inspections

    GET /inspections

    `bash

    curl -X GET \

    -H "Authorization: Bearer med_live_..." \

    -H "Content-Type: application/json" \

    https://api.medcompliance.com/v1/inspections

    `

    Response:

    `json

    {

    "data": [

    {

    "id": 123,

    "facility": "Memorial Hospital",

    "type": "annual",

    "status": "completed",

    "date": "2025-01-15",

    "technician": "John Doe"

    }

    ],

    "meta": {

    "total": 150,

    "page": 1,

    "per_page": 20

    }

    }

    `

    API Endpoints

    Inspections

    GET /inspections - List all inspections

    GET /inspections/{id} - Get inspection details

    POST /inspections - Create inspection

    PATCH /inspections/{id} - Update inspection

    DELETE /inspections/{id} - Delete inspection

    Reports

    GET /reports - List reports

    GET /reports/{id} - Download report

    POST /reports - Generate custom report

    Users

    GET /users - List users

    GET /users/{id} - Get user details

    POST /users - Create user

    PATCH /users/{id} - Update user

    Organizations

    GET /organizations - List organizations

    GET /organizations/{id} - Get organization details

    Pagination

    Query Parameters:

  • page: Page number (default: 1)
  • per_page: Items per page (default: 20, max: 100)
  • Example:

    `bash

    GET /inspections?page=2&per_page=50

    `

    Response includes:

    `json

    {

    "meta": {

    "total": 500,

    "page": 2,

    "per_page": 50,

    "total_pages": 10

    }

    }

    `

    Filtering

    Filter by field:

    `bash

    GET /inspections?status=completed&type=annual

    `

    Date range:

    `bash

    GET /inspections?start_date=2025-01-01&end_date=2025-12-31

    `

    Error Handling

    HTTP Status Codes:

  • 200 OK - Success
  • 201 Created - Resource created
  • 400 Bad Request - Invalid parameters
  • 401 Unauthorized - Invalid API key
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Resource doesn't exist
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error
  • Error Response:

    `json

    {

    "error": {

    "code": "invalid_request",

    "message": "Missing required field: facility_id",

    "details": {

    "field": "facility_id",

    "required": true

    }

    }

    }

    `

    Rate Limiting

    Limits:

  • Standard: 1,000 requests/hour
  • Enterprise: 10,000 requests/hour
  • Burst: 100 requests/minute
  • Rate Limit Headers:

    `

    X-RateLimit-Limit: 1000

    X-RateLimit-Remaining: 950

    X-RateLimit-Reset: 1640995200

    `

    Exceeding Limits:

  • Returns 429 status code
  • Retry after period specified in response
  • Implement exponential backoff
  • Best Practices

    1. Use Webhooks - Don't poll, use webhooks for real-time updates

    2. Cache Responses - Reduce API calls with caching

    3. Batch Requests - Combine multiple operations

    4. Handle Errors Gracefully - Retry with backoff

    5. Version Your Integrations - Specify API version in requests

    SDKs and Libraries

    Official SDKs:

  • JavaScript/Node.js: npm install @medcompliance/api
  • Python: pip install medcompliance
  • PHP: composer require medcompliance/api
  • Ruby: gem install medcompliance
  • Community Libraries:

  • C#/.NET
  • Java
  • Go
  • Testing

    Sandbox Environment:

  • Base URL: https://sandbox-api.medcompliance.com/v1
  • Test API keys start with med_test_
  • No charges for API calls
  • Sample data provided
  • Postman Collection:

  • Download from docs.medcompliance.com
  • Pre-configured requests
  • Example responses
  • Environment variables
  • Next Steps

    1. Read [API Authentication](/knowledge-base/api-authentication) guide

    2. Explore [API Endpoints Reference](/knowledge-base/api-endpoints)

    3. Set up [Webhooks](/knowledge-base/webhook-integration)

    4. Join developer community forum


    Need help? Email api-support@medcompliance.com or visit docs.medcompliance.com

    Was this article helpful?

    Let us know if you have any questions or feedback!

    MedCompliance - NFPA 99 Service Management Platform