Page Introduction

Source document library

Source files are raw upstream documentation artifacts used to build and validate the docs portal.

  • Use source docs when you need exact wording from baseline references.
  • Use rendered reference pages for day-to-day implementation workflow.
  • Validate high-impact changes against canonical and complete source files.

Canonical

Core/Common API Complete

Complete Core/Common API documentation with shared endpoints used by Workshop and CarOwner.

307Lines
7.7 KBFile size

Source: CORE-COMMON-API-COMPLETE.md

Document content

MinBil Complete API Documentation - Core and Common Endpoints

Generated from live Swagger on 2026-02-16T10:23:22Z.

Core API

  • Base path: /api/core
  • Primary purpose: cross-domain records shared between workshop and car owner contexts.

Core Endpoints

Generated from live Swagger on 2026-02-16T10:23:22Z.

Scope

  • Audience: Platform services
  • API title: MinBil Core API
  • API version: 1.0
  • Base path: /api/core
  • Total paths: 1
  • Total operations: 1

Authentication

  • Bearer: Authorization: Bearer <token>
  • APIKey: x-api-key: <api-key> (used on selected auth/bootstrap endpoints)

Response shape guidance

  • Newer endpoints usually return { data, meta } for success and { error: { ... } } for failures.
  • Some modules return RFC7807 (type/title/status/code/message) responses.
  • Older endpoints may still return simple { error: '...' } payloads.
  • Client integrations must always branch by HTTP status first.

Endpoint index

CoreVehicleServiceHistory

GET /vehicle-service-history/{registration_number}

Purpose: Endpoint operation.

Typical use cases:

  • Show maintenance history and service records per vehicle.
  • Generate exports and operational summaries.

Auth: Bearer token (Authorization: Bearer <token>)

Request parameters:

Name In Type Required Description Example
registration_number path string yes - BT57225

Responses:

  • 200: Success
{
  "data": {},
  "meta": {
    "request_id": "f59ee325-0445-4bd0-9bf1-73edcd7da151",
    "generated_at": "2026-02-12T10:00:00Z"
  }
}

cURL example:

curl -X GET 'https://api.minbil.no/api/core/vehicle-service-history/BT57225'\
  -H 'Accept: application/json'\
  -H 'Authorization: Bearer <access-token>'

Error handling notes:

  • Legacy endpoints may return either RFC7807 application/problem+json, { "error": "..." }, or structured { "error": { ... } } depending on module age.
  • Always branch on HTTP status first, then parse payload shape.
  • Respect 401/403 as auth/scope failures and do not retry blindly.

Common Endpoints

  • These endpoints are mounted under both workshop and car owner APIs.
  • Realtime config and presence semantics are shared patterns.

Workshop-common routes

  • PUT /api/ws/presence
  • GET /api/ws/realtime/config

CarOwner-common routes

  • PUT /api/co/presence
  • GET /api/co/realtime/config

Detailed Workshop-common endpoints

PUT /presence

Purpose: Endpoint operation.

Detailed behavior: Update user presence status. When going 'online', queued offline events are delivered.

Typical use cases:

  • Track online presence in chat/realtime contexts.

Auth: Bearer token (Authorization: Bearer <token>)

Request parameters:

  • No path/query/header parameters.

Request body:

  • Schema: PresenceRequest
{
  "status": "online"
}

Responses:

  • 200: Success
    • Schema: PresenceResponse
{
  "status": "string_value",
  "queued_delivered": 1
}

cURL example:

curl -X PUT 'https://api.minbil.no/api/ws/presence'\
  -H 'Accept: application/json'\
  -H 'Authorization: Bearer <access-token>'\
  -H 'Content-Type: application/json'\
  -d '{"status": "online"}'

Error handling notes:

  • Legacy endpoints may return either RFC7807 application/problem+json, { "error": "..." }, or structured { "error": { ... } } depending on module age.
  • Always branch on HTTP status first, then parse payload shape.
  • Respect 401/403 as auth/scope failures and do not retry blindly.

GET /realtime/config

Purpose: Endpoint operation.

Detailed behavior: Returns Supabase Realtime connection config and channel names for the authenticated user.

Typical use cases:

  • Expose realtime configuration to connected clients.

Auth: Bearer token (Authorization: Bearer <token>)

Request parameters:

  • No path/query/header parameters.

Responses:

  • 200: Success
    • Schema: RealtimeConfig
{
  "supabase_url": "string_value",
  "anon_key": "string_value",
  "channels": {},
  "enabled": true
}

cURL example:

curl -X GET 'https://api.minbil.no/api/ws/realtime/config'\
  -H 'Accept: application/json'\
  -H 'Authorization: Bearer <access-token>'

Error handling notes:

  • Legacy endpoints may return either RFC7807 application/problem+json, { "error": "..." }, or structured { "error": { ... } } depending on module age.
  • Always branch on HTTP status first, then parse payload shape.
  • Respect 401/403 as auth/scope failures and do not retry blindly.

Detailed CarOwner-common endpoints

PUT /presence

Purpose: Endpoint operation.

Detailed behavior: Update user presence status. When going 'online', queued offline events are delivered.

Typical use cases:

  • Track online presence in chat/realtime contexts.

Auth: Bearer token (Authorization: Bearer <token>)

Request parameters:

  • No path/query/header parameters.

Request body:

  • Schema: PresenceRequest
{
  "status": "online"
}

Responses:

  • 200: Success
    • Schema: PresenceResponse
{
  "status": "string_value",
  "queued_delivered": 1
}

cURL example:

curl -X PUT 'https://api.minbil.no/api/co/presence'\
  -H 'Accept: application/json'\
  -H 'Authorization: Bearer <access-token>'\
  -H 'Content-Type: application/json'\
  -d '{"status": "online"}'

Error handling notes:

  • Legacy endpoints may return either RFC7807 application/problem+json, { "error": "..." }, or structured { "error": { ... } } depending on module age.
  • Always branch on HTTP status first, then parse payload shape.
  • Respect 401/403 as auth/scope failures and do not retry blindly.

GET /realtime/config

Purpose: Endpoint operation.

Detailed behavior: Returns Supabase Realtime connection config and channel names for the authenticated user.

Typical use cases:

  • Expose realtime configuration to connected clients.

Auth: Bearer token (Authorization: Bearer <token>)

Request parameters:

  • No path/query/header parameters.

Responses:

  • 200: Success
    • Schema: RealtimeConfig
{
  "supabase_url": "string_value",
  "anon_key": "string_value",
  "channels": {},
  "enabled": true
}

cURL example:

curl -X GET 'https://api.minbil.no/api/co/realtime/config'\
  -H 'Accept: application/json'\
  -H 'Authorization: Bearer <access-token>'

Error handling notes:

  • Legacy endpoints may return either RFC7807 application/problem+json, { "error": "..." }, or structured { "error": { ... } } depending on module age.
  • Always branch on HTTP status first, then parse payload shape.
  • Respect 401/403 as auth/scope failures and do not retry blindly.

Operational behavior

  • GET /realtime/config is consumed by clients before opening realtime channels.
  • PUT /presence updates user availability/online state.
  • Both should be treated as low-latency support endpoints and monitored for elevated error rates.

Health Endpoint

  • Endpoint: GET /healthz
  • Mounted on the Flask app root (outside /api/* blueprints).
  • Purpose: lightweight readiness/liveness signal for local/dev/prod checks.

GET /healthz

Purpose: Health check for API service availability.

Auth: None (public endpoint).

Responses:

  • 200: Service is healthy.
{
  "status": "ok",
  "time": "2026-02-16T10:00:00Z",
  "client_ip": "127.0.0.1"
}

cURL example:

curl -X GET 'https://api.minbil.no/healthz' \
  -H 'Accept: application/json'

Operational notes:

  • status should be ok for healthy instances.
  • time is UTC timestamp from server.
  • client_ip reflects X-Forwarded-For or remote address.