Skip to main content

API Reference

Welcome to the CHRT API reference documentation. Our REST API allows you to access nautical chart data, manage API keys, handle team operations, and more.

Base URL

All API requests should be made to:
https://nmixhdvexhgizmxlnhqi.supabase.co/functions/v1

Authentication

The CHRT API uses API keys to authenticate requests. Include your API key in the Authorization header:
Authorization: Bearer chrt_sk_live_...
For public keys, you can also use the X-CHRT-API-Key header:
X-CHRT-API-Key: chrt_pk_live_...

Request Format

All POST and PUT requests should include a Content-Type: application/json header and a JSON body.
{
  "parameter": "value"
}

Response Format

All responses are returned in JSON format with consistent structure:

Success Response

{
  "data": {
    // Response data
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_abc123"
  }
}

Error Response

{
  "error": {
    "type": "invalid_request",
    "message": "The request parameters are invalid.",
    "details": {
      "field": "api_key",
      "code": "missing_required_parameter"
    },
    "documentation_url": "https://docs.chrt.com/errors#invalid_request"
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_abc123"
  }
}

HTTP Status Codes

The CHRT API uses conventional HTTP response codes:
CodeStatusDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
403ForbiddenInsufficient permissions
404Not FoundResource not found
409ConflictResource already exists
422Unprocessable EntityValid request but server cannot process
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error
503Service UnavailableService temporarily unavailable

Rate Limiting

Rate limits vary by plan and endpoint. Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200
X-RateLimit-Window: 3600
When you exceed the rate limit, you’ll receive a 429 status code:
{
  "error": {
    "type": "rate_limit_exceeded",
    "message": "You have exceeded the rate limit. Please try again later.",
    "details": {
      "limit": 1000,
      "window": 3600,
      "reset_at": "2024-01-15T11:00:00Z"
    }
  }
}

Pagination

List endpoints support pagination using cursor-based pagination:

Request Parameters

  • limit: Number of objects to return (default: 20, max: 100)
  • after: Cursor for pagination (returned in previous response)

Response Format

{
  "data": [
    // Array of objects
  ],
  "pagination": {
    "has_more": true,
    "after": "cursor_abc123"
  }
}

Example Request

curl "https://nmixhdvexhgizmxlnhqi.supabase.co/functions/v1/api-keys?limit=50&after=cursor_abc123" \
  -H "Authorization: Bearer chrt_sk_live_..."

Idempotency

To safely retry requests without performing the same operation twice, include an Idempotency-Key header:
curl https://nmixhdvexhgizmxlnhqi.supabase.co/functions/v1/generate-api-key \
  -H "Authorization: Bearer chrt_sk_live_..." \
  -H "Idempotency-Key: unique-key-123" \
  -H "Content-Type: application/json" \
  -d '{"name": "My API Key"}'

Webhooks

CHRT can send webhook events to notify your application of important events:
  • api_key.created - New API key created
  • api_key.regenerated - API key regenerated
  • api_key.revoked - API key revoked
  • team.member.added - New team member added
  • usage.threshold.reached - Usage threshold reached
Webhook payloads are signed with HMAC SHA-256. Verify signatures using the X-CHRT-Signature header.

SDKs and Tools

Support

Need help with the API? We’re here to help:

Changelog

Stay updated with API changes: