Build your pet app on Loki.

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.

loki-client.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 };
}
​
export async function* paginate<T>(path: string, limit = 200) {
for (let offset = 0; ; offset += limit) {
const sep = path.includes("?") ? "&" : "?";
const page = await loki<Page<T>>(`${path}${sep}limit=${limit}&offset=${offset}`);
yield* page.data;
if (offset + limit >= page.meta.total) return;
}
}

Coding with AI

Your AI builds the app. Loki brings the intelligence.

Two ways to integrate powerful pet intelligence into anything you’re building.

Vibe coding

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 builder

AI tools

Point 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 docs

What you can build with

Available now

  • Pets

    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

Coming soon

  • 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.

Quickstart

  1. Step 1: Request a key.

    Tell us what you're building. Keys are issued to a Loki account and carry only the scopes you need.

  2. Step 2: Make your first call.

    terminal
    curl "https://app.loki.pet/public-api/v1/pets" \
    -H "X-API-Key: $LOKI_API_KEY"
  3. Step 3: Keep your key secret.

    Call the API from your server, never from a browser or a mobile app bundle, and store the key in an environment variable.

API reference

Base URL: https://app.loki.pet/public-api/v1

Authentication

Send your API key in the X-API-Key header on every request. Keys look like loki_....

curl "https://app.loki.pet/public-api/v1/pets" \
-H "X-API-Key: $LOKI_API_KEY"

A missing or invalid key returns 401:

{
"error": "unauthorized",
"message": "Missing X-API-Key header."
}
  • Call the API from your server, never from a browser or a mobile app bundle.
  • Store the key in an environment variable such as LOKI_API_KEY. Never put it in code, logs or version control.
  • A key acts on the pets of the one Loki account it belongs to. Treat it like a database password.
  • Request only the scopes you need.

Scopes

Each key carries only the scopes it was issued with. A request without the right scope returns 403.

ScopeAllows
pets:readList and view pets.
pets:writeCreate, update and delete pets.
care:readList and view care items.
care:writeCreate, update and delete care items.
journal:readList and view journal entries.
photos:readList and view photos.

Rate limits

60 requests per minute per key, plus a per-IP limit. Exceeding it returns 429 rate_limited.

HeaderMeaning
RateLimit-LimitRequests allowed in the current window.
RateLimit-RemainingRequests left in the current window.
RateLimit-ResetSeconds until the window resets.
Retry-AfterOnly on a 429 response: seconds to wait before retrying.

On a 429, wait for the number of seconds in Retry-After and try again.

Pagination

List endpoints accept limit (1 to 200, default 50) and offset (default 0).

{
"data": [
"..."
],
"meta": {
"total": 42,
"limit": 50,
"offset": 0
}
}

Single resources are returned as:

{
"data": {
"...": "..."
}
}
export interface Page<T> {
data: T[];
meta: { total: number; limit: number; offset: number };
}

Errors

Errors return { "error": code, "message": text }.

StatusCodeMeaning
400invalid_requestThe body failed validation. The message lists the fields.
401unauthorizedThe X-API-Key header is missing or the key is invalid.
403forbiddenThe key lacks the scope this endpoint needs.
404not_foundThe resource does not exist or is not owned by the key's account.
429rate_limitedToo many requests. Wait for Retry-After seconds, then retry.
500server_errorSomething went wrong on our side.

Pets

Pet profiles. Each pet belongs to the account that owns the key.

Model

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";
}
GET/pets

List pets

Returns the pets on the key's account.

Required scope: pets:read

Query parameters
NameTypeRequiredDescription
limitintegerNoItems per page, 1 to 200. Default 50.
offsetintegerNoItems to skip. Default 0.
Example request
curl "https://app.loki.pet/public-api/v1/pets" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": [
{
"id": "a1b2c3d4-...",
"name": "Luna",
"type": "dog",
"breed": "Labrador Retriever",
"description": "Loves fetch and belly rubs",
"dateOfBirth": "2022-03-15",
"weight": "28kg",
"sex": "female"
}
],
"meta": {
"total": 1,
"limit": 50,
"offset": 0
}
}
GET/pets/:id

Get a pet

Returns one pet.

Required scope: pets:read

Path parameters
NameTypeRequiredDescription
idstringYesThe pet id.
Example request
curl "https://app.loki.pet/public-api/v1/pets/PET_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": {
"id": "a1b2c3d4-...",
"name": "Luna",
"type": "dog",
"breed": "Labrador Retriever",
"description": "Loves fetch and belly rubs",
"dateOfBirth": "2022-03-15",
"weight": "28kg",
"sex": "female"
}
}
POST/pets

Create a pet

Creates a pet on the key's account. name and description are required.

Required scope: pets:write

Body (JSON)
NameTypeRequiredDescription
namestringYes1 to 100 characters.
descriptionstringYes1 to 500 characters.
typestringNoFor example dog or cat.
breedstringNoUp to 100 characters.
dateOfBirthstring (YYYY-MM-DD)NoDate of birth.
weightstringNoA string with its unit, for example "28kg".
sexenumNomale, female or unknown.
Example request
curl -X POST "https://app.loki.pet/public-api/v1/pets" \
-H "X-API-Key: $LOKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Milo",
"description": "Indoor cat, very curious",
"type": "cat",
"breed": "Maine Coon"
}'
Example response
{
"data": {
"id": "e5f6a7b8-...",
"name": "Milo",
"type": "cat",
"breed": "Maine Coon",
"description": "Indoor cat, very curious"
}
}
PUT/pets/:id

Update a pet

Updates a pet. Same fields as creating, all optional.

Required scope: pets:write

Path parameters
NameTypeRequiredDescription
idstringYesThe pet id.
Body (JSON)
NameTypeRequiredDescription
namestringNo1 to 100 characters.
descriptionstringNo1 to 500 characters.
typestringNoFor example dog or cat.
breedstringNoUp to 100 characters.
dateOfBirthstring (YYYY-MM-DD)NoDate of birth.
weightstringNoA string with its unit, for example "28kg".
sexenumNomale, female or unknown.
Example request
curl -X PUT "https://app.loki.pet/public-api/v1/pets/PET_ID" \
-H "X-API-Key: $LOKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"weight": "28kg"
}'
Example response

Returns the updated pet as { data: {...} }.

DELETE/pets/:id

Delete a pet

Deletes a pet.

Required scope: pets:write

Path parameters
NameTypeRequiredDescription
idstringYesThe pet id.
Example request
curl -X DELETE "https://app.loki.pet/public-api/v1/pets/PET_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"success": true
}

Care calendar

Feedings, medication, vet visits, grooming and exercise, with recurrence and reminders.

Models

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>;
}
GET/care-items

List care items

Returns care items, optionally for one pet.

Required scope: care:read

Query parameters
NameTypeRequiredDescription
petIdstringNoOnly return items for this pet.
limitintegerNoItems per page, 1 to 200. Default 50.
offsetintegerNoItems to skip. Default 0.
Example request
curl "https://app.loki.pet/public-api/v1/care-items?petId=PET_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": [
{
"id": "f1e2d3c4-...",
"title": "Morning feeding",
"itemType": "feeding",
"startsAt": "2026-01-15T08:00:00.000Z",
"allDay": false,
"recurrenceType": "daily",
"petIds": [
"a1b2c3d4-..."
]
}
],
"meta": {
"total": 1,
"limit": 50,
"offset": 0
}
}
GET/care-items/:id

Get a care item

Returns one care item.

Required scope: care:read

Path parameters
NameTypeRequiredDescription
idstringYesThe care item id.
Example request
curl "https://app.loki.pet/public-api/v1/care-items/CARE_ITEM_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": {
"id": "f1e2d3c4-...",
"title": "Morning feeding",
"itemType": "feeding",
"startsAt": "2026-01-15T08:00:00.000Z",
"allDay": false,
"recurrenceType": "daily",
"petIds": [
"a1b2c3d4-..."
]
}
}
POST/care-items

Create a care item

Creates a care item. title, itemType and startsAt are required.

Required scope: care:write

Body (JSON)
NameTypeRequiredDescription
titlestringYes1 to 200 characters.
itemTypeenumYesfeeding, medication, vet_visit, grooming, exercise or other.
startsAtstring (ISO 8601)YesWhen the item starts.
endsAtstring (ISO 8601)NoWhen the item ends.
allDaybooleanNoDefault false.
descriptionstringNoFree text.
petIdsstring[]NoThe pets this item is for.
recurrenceTypeenumNoonce (default), daily, weekly or monthly.
recurrenceIntervalintegerNoFor example 2 with weekly means every two weeks.
recurrenceEndDatestring (ISO 8601)NoWhen the recurrence stops.
reminderEnabledbooleanNoDefault false.
reminderLeadMinutesintegerNoMinutes before the item to send the reminder.
metadataobjectNoFor example dosage or clinicName.
Example request
curl -X POST "https://app.loki.pet/public-api/v1/care-items" \
-H "X-API-Key: $LOKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Vet checkup",
"itemType": "vet_visit",
"startsAt": "2026-02-01T10:30:00Z",
"petIds": [
"a1b2c3d4-..."
],
"metadata": {
"clinicName": "Happy Paws Veterinary"
}
}'
Example response

Returns the created care item as { data: {...} }.

PUT/care-items/:id

Update a care item

Updates a care item. Same fields as creating, all optional.

Required scope: care:write

Path parameters
NameTypeRequiredDescription
idstringYesThe care item id.
Body (JSON)
NameTypeRequiredDescription
titlestringNo1 to 200 characters.
itemTypeenumNofeeding, medication, vet_visit, grooming, exercise or other.
startsAtstring (ISO 8601)NoWhen the item starts.
endsAtstring (ISO 8601)NoWhen the item ends.
allDaybooleanNoDefault false.
descriptionstringNoFree text.
petIdsstring[]NoThe pets this item is for.
recurrenceTypeenumNoonce (default), daily, weekly or monthly.
recurrenceIntervalintegerNoFor example 2 with weekly means every two weeks.
recurrenceEndDatestring (ISO 8601)NoWhen the recurrence stops.
reminderEnabledbooleanNoDefault false.
reminderLeadMinutesintegerNoMinutes before the item to send the reminder.
metadataobjectNoFor example dosage or clinicName.
Example request
curl -X PUT "https://app.loki.pet/public-api/v1/care-items/CARE_ITEM_ID" \
-H "X-API-Key: $LOKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reminderEnabled": true,
"reminderLeadMinutes": 10
}'
Example response

Returns the updated care item as { data: {...} }.

DELETE/care-items/:id

Delete a care item

Deletes a care item.

Required scope: care:write

Path parameters
NameTypeRequiredDescription
idstringYesThe care item id.
Example request
curl -X DELETE "https://app.loki.pet/public-api/v1/care-items/CARE_ITEM_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"success": true
}

Journal

Read only. Entries are moments Loki captures from conversations.

Model

export interface JournalEntry {
id: string;
petId: string;
title: string;
content: string;
createdAt: string; // ISO 8601, UTC
}
GET/journal-entries

List journal entries

Returns journal entries, optionally for one pet.

Required scope: journal:read

Query parameters
NameTypeRequiredDescription
petIdstringNoOnly return items for this pet.
limitintegerNoItems per page, 1 to 200. Default 50.
offsetintegerNoItems to skip. Default 0.
Example request
curl "https://app.loki.pet/public-api/v1/journal-entries?petId=PET_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": [
{
"id": "d4e5f6a7-...",
"petId": "a1b2c3d4-...",
"title": "First trip to the beach",
"content": "Luna was hesitant at first but ended up sprinting along the shoreline for twenty minutes straight.",
"createdAt": "2026-01-10T14:22:00.000Z"
}
],
"meta": {
"total": 1,
"limit": 50,
"offset": 0
}
}

Photos

Read only. Pet photos with captions.

Model

export interface Photo {
id: string;
petId: string;
url: string;
caption: string;
}
GET/photos

List photos

Returns photos.

Required scope: photos:read

Query parameters
NameTypeRequiredDescription
limitintegerNoItems per page, 1 to 200. Default 50.
offsetintegerNoItems to skip. Default 0.
Example request
curl "https://app.loki.pet/public-api/v1/photos" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": [
{
"id": "c3b2a1f0-...",
"petId": "a1b2c3d4-...",
"url": "https://storage.example.com/photos/luna-beach.jpg",
"caption": "Luna at the beach"
}
],
"meta": {
"total": 1,
"limit": 50,
"offset": 0
}
}
GET/photos/:id

Get a photo

Returns one photo.

Required scope: photos:read

Path parameters
NameTypeRequiredDescription
idstringYesThe photo id.
Example request
curl "https://app.loki.pet/public-api/v1/photos/PHOTO_ID" \
-H "X-API-Key: $LOKI_API_KEY"
Example response
{
"data": {
"id": "c3b2a1f0-...",
"petId": "a1b2c3d4-...",
"url": "https://storage.example.com/photos/luna-beach.jpg",
"caption": "Luna at the beach"
}
}

Prompt builder

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

  1. Answer the three questions and copy your prompt.
  2. Paste it into Replit and let it build.
  3. Add your API key as a secret named LOKI_API_KEY. Never paste the key itself into the prompt.
Which tool are you using?
What should your app do?

Pick as many as you like.

Are you starting fresh?

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.

Ready-made prompts

In a hurry? Start from one of these and adjust it in your tool.

Let your AI tool read the docs.

Planned: a Loki connector (MCP) so coding assistants can browse the docs directly.

Pricing

The Loki API is free during private access. We'll announce usage-based plans, including a free tier, before anything is charged.

Request API access

Tell us what you're building. We'll reply by email.

How are you building?
Features you want
At least 20 characters.0/2000