stable.se

API-tokens och webhooks ingår inte i de planer vi säljer idag. Hör av dig innan du bygger på API:et.

Utvecklardokumentationen är för närvarande bara tillgänglig på engelska.

Getting Started

A quick introduction to the Stable API and how to make your first request.

2 min read

Introduction

The Stable API gives you programmatic access to your organization's stable management data: horses, bookings, tasks, billing and more, through a RESTful JSON API.

Base URL: https://api.stable.se/v1

All API paths start with /v1. Request and response bodies are JSON.

Prerequisites

Before you begin, you'll need:

  • A Stable account with an organization
  • The API Access entitlement on your organization plan
  • An API token with the scopes you need (see Authentication)

Your First Request

Check which application and organization your token belongs to:

curl https://api.stable.se/v1/auth/token-info \
  -H "Authorization: Bearer stl_sk_your_token_here"

The response:

{
  "type": "api_token",
  "application": { "public_id": "app_example", "name": "Barn sync" },
  "organization": { "public_id": "org_example", "name": "Sunrise Stables" },
  "scopes": ["read:horses"]
}

Each endpoint has its own access rules, and not every endpoint accepts API tokens. See Authentication.

Key Concepts

Public IDs

All entities use prefixed public IDs:

EntityPrefixExample
Horsehrs_hrs_abc123
Userusr_usr_def456
Organizationorg_org_xyz789
Bookingbkg_bkg_ghi012
Invoiceinv_inv_jkl345

Use these IDs in all API requests and store them in your system for cross-referencing.

Response Bodies

Response shapes are endpoint-specific. Some endpoints return the resource directly, as token-info does. Others wrap the result in an envelope and put it in data:

{
  "status": "200 OK",
  "message": null,
  "data": { ... },
  "error": null,
  "code": null
}

Errors share one shape with a machine-readable code:

{
  "status": "404 Not Found",
  "message": "Horse not found",
  "code": "not_found"
}

Content Type

Send Content-Type: application/json with every request that has a body (POST, PATCH, PUT).

Next Steps