/petsList pets
Returns the pets on the key's account.
Required scope: pets:read
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Items per page, 1 to 200. Default 50. |
| offset | integer | No | Items to skip. Default 0. |
Pet profiles, care calendars, journals and photos, ready to use through one simple API. Code it by hand, or hand our ready-made prompts to your AI coding tool.
The Loki API is in private access. Read everything now and request a key when you're ready.
Coding with AI
Two ways to integrate powerful pet intelligence into anything you’re building.
Pick your tool and what your app should do. The prompt builder writes the exact prompt for you: paste it in and Loki is integrated in seconds.
Explore prompt builderPoint your coding assistant at the machine-readable docs instead. llms.txt and the OpenAPI spec give it the exact wording, so it can integrate Loki on its own.
Explore AI-ready docsPets
Create, read, update and delete pet profiles.
pets:read, pets:write
Care calendar
Feedings, medication, vet visits, grooming and exercise, with recurrence and reminders.
care:read, care:write
Journal
Read the moments Loki captures from conversations.
journal:read
Photos
Read pet photos with captions.
photos:read
Loki ChatComing soon
Loki's conversation, inside your app.
Vet recordsComing soon
Send a document, get a plain-language summary.
MonitoringComing soon
Loki watching a symptom over time.
Events (webhooks)Coming soon
Get notified when a reminder is due or Loki raises an urgent alert.
Today, each API key works with the pets on the Loki account it belongs to. Access for your own app's users is planned.
Tell us what you're building. Keys are issued to a Loki account and carry only the scopes you need.
Call the API from your server, never from a browser or a mobile app bundle, and store the key in an environment variable.
Base URL: https://app.loki.pet/public-api/v1
Send your API key in the X-API-Key header on every request. Keys look like loki_....
A missing or invalid key returns 401:
Each key carries only the scopes it was issued with. A request without the right scope returns 403.
| Scope | Allows |
|---|---|
| pets:read | List and view pets. |
| pets:write | Create, update and delete pets. |
| care:read | List and view care items. |
| care:write | Create, update and delete care items. |
| journal:read | List and view journal entries. |
| photos:read | List and view photos. |
60 requests per minute per key, plus a per-IP limit. Exceeding it returns 429 rate_limited.
| Header | Meaning |
|---|---|
| RateLimit-Limit | Requests allowed in the current window. |
| RateLimit-Remaining | Requests left in the current window. |
| RateLimit-Reset | Seconds until the window resets. |
| Retry-After | Only on a 429 response: seconds to wait before retrying. |
On a 429, wait for the number of seconds in Retry-After and try again.
List endpoints accept limit (1 to 200, default 50) and offset (default 0).
Single resources are returned as:
Errors return { "error": code, "message": text }.
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The body failed validation. The message lists the fields. |
| 401 | unauthorized | The X-API-Key header is missing or the key is invalid. |
| 403 | forbidden | The key lacks the scope this endpoint needs. |
| 404 | not_found | The resource does not exist or is not owned by the key's account. |
| 429 | rate_limited | Too many requests. Wait for Retry-After seconds, then retry. |
| 500 | server_error | Something went wrong on our side. |
Pet profiles. Each pet belongs to the account that owns the key.
/petsReturns the pets on the key's account.
Required scope: pets:read
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Items per page, 1 to 200. Default 50. |
| offset | integer | No | Items to skip. Default 0. |
/pets/:idReturns one pet.
Required scope: pets:read
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The pet id. |
/petsCreates a pet on the key's account. name and description are required.
Required scope: pets:write
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | 1 to 100 characters. |
| description | string | Yes | 1 to 500 characters. |
| type | string | No | For example dog or cat. |
| breed | string | No | Up to 100 characters. |
| dateOfBirth | string (YYYY-MM-DD) | No | Date of birth. |
| weight | string | No | A string with its unit, for example "28kg". |
| sex | enum | No | male, female or unknown. |
/pets/:idUpdates a pet. Same fields as creating, all optional.
Required scope: pets:write
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The pet id. |
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | No | 1 to 100 characters. |
| description | string | No | 1 to 500 characters. |
| type | string | No | For example dog or cat. |
| breed | string | No | Up to 100 characters. |
| dateOfBirth | string (YYYY-MM-DD) | No | Date of birth. |
| weight | string | No | A string with its unit, for example "28kg". |
| sex | enum | No | male, female or unknown. |
Returns the updated pet as { data: {...} }.
/pets/:idDeletes a pet.
Required scope: pets:write
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The pet id. |
Feedings, medication, vet visits, grooming and exercise, with recurrence and reminders.
/care-itemsReturns care items, optionally for one pet.
Required scope: care:read
| Name | Type | Required | Description |
|---|---|---|---|
| petId | string | No | Only return items for this pet. |
| limit | integer | No | Items per page, 1 to 200. Default 50. |
| offset | integer | No | Items to skip. Default 0. |
/care-items/:idReturns one care item.
Required scope: care:read
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The care item id. |
/care-itemsCreates a care item. title, itemType and startsAt are required.
Required scope: care:write
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | 1 to 200 characters. |
| itemType | enum | Yes | feeding, medication, vet_visit, grooming, exercise or other. |
| startsAt | string (ISO 8601) | Yes | When the item starts. |
| endsAt | string (ISO 8601) | No | When the item ends. |
| allDay | boolean | No | Default false. |
| description | string | No | Free text. |
| petIds | string[] | No | The pets this item is for. |
| recurrenceType | enum | No | once (default), daily, weekly or monthly. |
| recurrenceInterval | integer | No | For example 2 with weekly means every two weeks. |
| recurrenceEndDate | string (ISO 8601) | No | When the recurrence stops. |
| reminderEnabled | boolean | No | Default false. |
| reminderLeadMinutes | integer | No | Minutes before the item to send the reminder. |
| metadata | object | No | For example dosage or clinicName. |
Returns the created care item as { data: {...} }.
/care-items/:idUpdates a care item. Same fields as creating, all optional.
Required scope: care:write
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The care item id. |
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | No | 1 to 200 characters. |
| itemType | enum | No | feeding, medication, vet_visit, grooming, exercise or other. |
| startsAt | string (ISO 8601) | No | When the item starts. |
| endsAt | string (ISO 8601) | No | When the item ends. |
| allDay | boolean | No | Default false. |
| description | string | No | Free text. |
| petIds | string[] | No | The pets this item is for. |
| recurrenceType | enum | No | once (default), daily, weekly or monthly. |
| recurrenceInterval | integer | No | For example 2 with weekly means every two weeks. |
| recurrenceEndDate | string (ISO 8601) | No | When the recurrence stops. |
| reminderEnabled | boolean | No | Default false. |
| reminderLeadMinutes | integer | No | Minutes before the item to send the reminder. |
| metadata | object | No | For example dosage or clinicName. |
Returns the updated care item as { data: {...} }.
/care-items/:idDeletes a care item.
Required scope: care:write
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The care item id. |
Read only. Entries are moments Loki captures from conversations.
/journal-entriesReturns journal entries, optionally for one pet.
Required scope: journal:read
| Name | Type | Required | Description |
|---|---|---|---|
| petId | string | No | Only return items for this pet. |
| limit | integer | No | Items per page, 1 to 200. Default 50. |
| offset | integer | No | Items to skip. Default 0. |
Read only. Pet photos with captions.
/photosReturns photos.
Required scope: photos:read
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Items per page, 1 to 200. Default 50. |
| offset | integer | No | Items to skip. Default 0. |
/photos/:idReturns one photo.
Required scope: photos:read
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The photo id. |
Answer three quick questions and your prompt writes itself. Then copy it and paste it into your tool: no code needed.
How to use it
Your prompt
Ready to copy. It updates as you change your answers.
# Task: Build a new pet app using the Loki API ## Integration contract - Base URL: https://app.loki.pet/public-api/v1 - Auth: header `X-API-Key: <LOKI_API_KEY>` on every request. Required scopes for this build: pets:read, pets:write, care:read, care:write. - Content type: JSON in and out. Lists return `{ data: T[], meta: { total, limit, offset } }`, single resources return `{ data: T }`, deletes return `{ success: true }`. - Errors: `{ error: string, message: string }`. Codes: 400 invalid_request, 401 unauthorized, 403 forbidden (missing scope), 404 not_found, 429 rate_limited, 500 server_error. - Rate limit: 60 requests/minute per key. Every response has `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`; a 429 has `Retry-After` (seconds). - Full reference for you to read before writing code: https://loki.pet/llms-full.txt - OpenAPI 3.1 spec (use it to check request and response shapes): https://loki.pet/developers/openapi.json ## Security (non-negotiable) - A Loki key acts on ONE Loki account. Treat it like a database password. - Store it only as the server-side secret `LOKI_API_KEY`. Never ship it to the browser, a mobile bundle, logs or version control. - The client talks only to my own backend. My backend talks to Loki. - Every proxy route below must require my app's own authenticated session and must only forward the exact routes listed (no catch-all proxy). ## Architecture 1. One Loki client module (`lokiClient`) on the server: - `request<T>(method, path, body?)` using fetch with a 10 second timeout (AbortSignal.timeout). - On 429: wait `Retry-After` seconds, retry, maximum 3 attempts. - On 500: retry once after 500 ms. Never retry 400, 401, 403 or 404. - Throw a typed `LokiError { status, code, message }` for every non-2xx response. - `paginate<T>(path)`: async generator using limit=200 and offset, stopping when offset + limit >= meta.total. 2. Proxy routes in my backend (exact mapping): | My route | Loki call | Scope | | --- | --- | --- | | GET /api/pets?limit&offset | GET /pets | pets:read | | GET /api/pets/:id | GET /pets/:id | pets:read | | POST /api/pets | POST /pets | pets:write | | PUT /api/pets/:id | PUT /pets/:id | pets:write | | DELETE /api/pets/:id | DELETE /pets/:id | pets:write | | GET /api/care-items?petId&limit&offset | GET /care-items | care:read | | GET /api/care-items/:id | GET /care-items/:id | care:read | | POST /api/care-items | POST /care-items | care:write | | PUT /api/care-items/:id | PUT /care-items/:id | care:write | | DELETE /api/care-items/:id | DELETE /care-items/:id | care:write | 3. Map LokiError to my API: 400 -> 422 with field messages, 401/403 -> 502 with "Loki access problem" (log it, alert me), 404 -> 404, 429 after retries -> 503 with "Busy, try again shortly". ## Data models ```ts export interface Pet { id: string; name: string; description: string; type?: string; breed?: string; dateOfBirth?: string; // YYYY-MM-DD weight?: string; // "9kg" sex?: "male" | "female" | "unknown"; } export type CareItemType = | "feeding" | "medication" | "vet_visit" | "grooming" | "exercise" | "other"; export interface CareItem { id: string; title: string; itemType: CareItemType; startsAt: string; // ISO 8601, UTC endsAt?: string; allDay?: boolean; petIds: string[]; recurrenceType?: "once" | "daily" | "weekly" | "monthly"; reminderEnabled?: boolean; reminderLeadMinutes?: number; metadata?: Record<string, unknown>; } export interface Page<T> { data: T[]; meta: { total: number; limit: number; offset: number }; } ``` ## Validation (mirror Loki's rules on my side before sending) - Pet: name string 1 to 100 chars (required on create); description string 1 to 500 chars (required on create); breed up to 100 chars; dateOfBirth matches YYYY-MM-DD; sex is male, female or unknown. On update, all fields optional but at least one present. - Care item: title string 1 to 200 chars (required on create); itemType one of feeding, medication, vet_visit, grooming, exercise, other (required on create); startsAt valid ISO 8601 (required on create); endsAt after startsAt when present; recurrenceType one of once, daily, weekly, monthly (default once); recurrenceInterval positive integer; recurrenceEndDate after startsAt; reminderLeadMinutes non-negative integer and only meaningful when reminderEnabled is true; petIds is an array of UUID strings; metadata is a flat JSON object. ## Dates and units - `startsAt`, `endsAt`, `recurrenceEndDate`, `createdAt`: ISO 8601 in UTC. Send UTC, display in the user's local time zone. - `dateOfBirth`: plain date `YYYY-MM-DD`, no time zone conversion. - `weight`: a string with its unit (for example "9kg"). Do not parse it into a number. ## Screens - Pets: a list (name, type, breed, age computed from dateOfBirth), a detail page with all fields, an add/edit form using the validation above, and delete behind a confirmation dialog that names the pet. - Care agenda: next 14 days grouped by local date, each item showing local time (or 'All day'), title, itemType label and recurrence label. Filter by pet (petId). Add/edit form with a recurrence section (type, interval, end date) and a reminder toggle with lead time in minutes. Use metadata for medication dosage (metadata.dosage) and clinic name (metadata.clinicName). Every screen: loading skeleton, empty state, error state with retry. ## Acceptance criteria - [ ] LOKI_API_KEY is read only on the server; searching the built client bundle for "X-API-Key" finds nothing. - [ ] Every proxy route returns 401 without my app's session. - [ ] Lists page correctly beyond 200 items. - [ ] A forced 429 (mock it) waits Retry-After and succeeds on retry. - [ ] Invalid input is rejected by my validation before any Loki call. ## Implementation notes for Replit - Add LOKI_API_KEY in the Secrets tool, never in code. - Put lokiClient in server/lokiClient.ts and the routes in server/routes/loki.ts, registered in the existing Express app. - Use the existing auth middleware for the session check.
In a hurry? Start from one of these and adjust it in your tool.
llms.txt
A short index of the Loki API for AI assistants.
https://loki.pet/llms.txtllms-full.txt
The complete reference in one plain-text file. Point your tool here.
https://loki.pet/llms-full.txtOpenAPI
A standard OpenAPI 3.1 spec for code generators and API clients.
https://loki.pet/developers/openapi.jsonPlanned: a Loki connector (MCP) so coding assistants can browse the docs directly.
The Loki API is free during private access. We'll announce usage-based plans, including a free tier, before anything is charged.
Tell us what you're building. We'll reply by email.