{
  "openapi": "3.1.0",
  "info": {
    "title": "Loki API",
    "version": "1.0.0",
    "summary": "REST API for pet profiles, care calendars, journals and photos.",
    "description": "REST API for pet profiles, care calendars, journals and photos. 60 requests per minute per key, plus a per-IP limit. Exceeding it returns 429 rate_limited. Today, each API key works with the pets on the Loki account it belongs to. Access for your own app's users is planned.",
    "contact": {
      "name": "Loki for Developers",
      "url": "https://loki.pet/developers"
    }
  },
  "servers": [
    {
      "url": "https://app.loki.pet/public-api/v1"
    }
  ],
  "tags": [
    {
      "name": "Pets",
      "description": "Pet profiles. Each pet belongs to the account that owns the key."
    },
    {
      "name": "Care calendar",
      "description": "Feedings, medication, vet visits, grooming and exercise, with recurrence and reminders."
    },
    {
      "name": "Journal",
      "description": "Read only. Entries are moments Loki captures from conversations."
    },
    {
      "name": "Photos",
      "description": "Read only. Pet photos with captions."
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/pets": {
      "get": {
        "operationId": "getPets",
        "summary": "List pets",
        "description": "Returns the pets on the key's account. Required scope: pets:read.",
        "tags": [
          "Pets"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "pets:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Items to skip. Default 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Pet"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PageMeta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPet",
        "summary": "Create a pet",
        "description": "Creates a pet on the key's account. name and description are required. Required scope: pets:write.",
        "tags": [
          "Pets"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "pets:write",
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Pet"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "description"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "1 to 100 characters."
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "1 to 500 characters."
                  },
                  "type": {
                    "type": "string",
                    "description": "For example dog or cat."
                  },
                  "breed": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Up to 100 characters."
                  },
                  "dateOfBirth": {
                    "type": "string",
                    "format": "date",
                    "description": "Date of birth."
                  },
                  "weight": {
                    "type": "string",
                    "description": "A string with its unit, for example \"28kg\"."
                  },
                  "sex": {
                    "type": "string",
                    "enum": [
                      "male",
                      "female",
                      "unknown"
                    ],
                    "description": "male, female or unknown."
                  }
                }
              },
              "example": {
                "name": "Milo",
                "description": "Indoor cat, very curious",
                "type": "cat",
                "breed": "Maine Coon"
              }
            }
          }
        }
      }
    },
    "/pets/{id}": {
      "get": {
        "operationId": "getPet",
        "summary": "Get a pet",
        "description": "Returns one pet. Required scope: pets:read.",
        "tags": [
          "Pets"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "pets:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The pet id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Pet"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updatePet",
        "summary": "Update a pet",
        "description": "Updates a pet. Same fields as creating, all optional. Required scope: pets:write.",
        "tags": [
          "Pets"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "pets:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The pet id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Pet"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "1 to 100 characters."
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "1 to 500 characters."
                  },
                  "type": {
                    "type": "string",
                    "description": "For example dog or cat."
                  },
                  "breed": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Up to 100 characters."
                  },
                  "dateOfBirth": {
                    "type": "string",
                    "format": "date",
                    "description": "Date of birth."
                  },
                  "weight": {
                    "type": "string",
                    "description": "A string with its unit, for example \"28kg\"."
                  },
                  "sex": {
                    "type": "string",
                    "enum": [
                      "male",
                      "female",
                      "unknown"
                    ],
                    "description": "male, female or unknown."
                  }
                }
              },
              "example": {
                "weight": "28kg"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePet",
        "summary": "Delete a pet",
        "description": "Deletes a pet. Required scope: pets:write.",
        "tags": [
          "Pets"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "pets:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The pet id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/care-items": {
      "get": {
        "operationId": "getCareItems",
        "summary": "List care items",
        "description": "Returns care items, optionally for one pet. Required scope: care:read.",
        "tags": [
          "Care calendar"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "care:read",
        "parameters": [
          {
            "name": "petId",
            "in": "query",
            "required": false,
            "description": "Only return items for this pet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Items to skip. Default 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CareItem"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PageMeta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCareItem",
        "summary": "Create a care item",
        "description": "Creates a care item. title, itemType and startsAt are required. Required scope: care:write.",
        "tags": [
          "Care calendar"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "care:write",
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CareItem"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "itemType",
                  "startsAt"
                ],
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "1 to 200 characters."
                  },
                  "itemType": {
                    "type": "string",
                    "enum": [
                      "feeding",
                      "medication",
                      "vet_visit",
                      "grooming",
                      "exercise",
                      "other"
                    ],
                    "description": "feeding, medication, vet_visit, grooming, exercise or other."
                  },
                  "startsAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the item starts."
                  },
                  "endsAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the item ends."
                  },
                  "allDay": {
                    "type": "boolean",
                    "default": false,
                    "description": "Default false."
                  },
                  "description": {
                    "type": "string",
                    "description": "Free text."
                  },
                  "petIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The pets this item is for."
                  },
                  "recurrenceType": {
                    "type": "string",
                    "enum": [
                      "once",
                      "daily",
                      "weekly",
                      "monthly"
                    ],
                    "default": "once",
                    "description": "once (default), daily, weekly or monthly."
                  },
                  "recurrenceInterval": {
                    "type": "integer",
                    "description": "For example 2 with weekly means every two weeks."
                  },
                  "recurrenceEndDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the recurrence stops."
                  },
                  "reminderEnabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "Default false."
                  },
                  "reminderLeadMinutes": {
                    "type": "integer",
                    "description": "Minutes before the item to send the reminder."
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "For example dosage or clinicName."
                  }
                }
              },
              "example": {
                "title": "Vet checkup",
                "itemType": "vet_visit",
                "startsAt": "2026-02-01T10:30:00Z",
                "petIds": [
                  "a1b2c3d4-..."
                ],
                "metadata": {
                  "clinicName": "Happy Paws Veterinary"
                }
              }
            }
          }
        }
      }
    },
    "/care-items/{id}": {
      "get": {
        "operationId": "getCareItem",
        "summary": "Get a care item",
        "description": "Returns one care item. Required scope: care:read.",
        "tags": [
          "Care calendar"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "care:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The care item id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CareItem"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateCareItem",
        "summary": "Update a care item",
        "description": "Updates a care item. Same fields as creating, all optional. Required scope: care:write.",
        "tags": [
          "Care calendar"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "care:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The care item id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CareItem"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "1 to 200 characters."
                  },
                  "itemType": {
                    "type": "string",
                    "enum": [
                      "feeding",
                      "medication",
                      "vet_visit",
                      "grooming",
                      "exercise",
                      "other"
                    ],
                    "description": "feeding, medication, vet_visit, grooming, exercise or other."
                  },
                  "startsAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the item starts."
                  },
                  "endsAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the item ends."
                  },
                  "allDay": {
                    "type": "boolean",
                    "default": false,
                    "description": "Default false."
                  },
                  "description": {
                    "type": "string",
                    "description": "Free text."
                  },
                  "petIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The pets this item is for."
                  },
                  "recurrenceType": {
                    "type": "string",
                    "enum": [
                      "once",
                      "daily",
                      "weekly",
                      "monthly"
                    ],
                    "default": "once",
                    "description": "once (default), daily, weekly or monthly."
                  },
                  "recurrenceInterval": {
                    "type": "integer",
                    "description": "For example 2 with weekly means every two weeks."
                  },
                  "recurrenceEndDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the recurrence stops."
                  },
                  "reminderEnabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "Default false."
                  },
                  "reminderLeadMinutes": {
                    "type": "integer",
                    "description": "Minutes before the item to send the reminder."
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "For example dosage or clinicName."
                  }
                }
              },
              "example": {
                "reminderEnabled": true,
                "reminderLeadMinutes": 10
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteCareItem",
        "summary": "Delete a care item",
        "description": "Deletes a care item. Required scope: care:write.",
        "tags": [
          "Care calendar"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "care:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The care item id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/journal-entries": {
      "get": {
        "operationId": "getJournalEntries",
        "summary": "List journal entries",
        "description": "Returns journal entries, optionally for one pet. Required scope: journal:read.",
        "tags": [
          "Journal"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "journal:read",
        "parameters": [
          {
            "name": "petId",
            "in": "query",
            "required": false,
            "description": "Only return items for this pet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Items to skip. Default 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JournalEntry"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PageMeta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/photos": {
      "get": {
        "operationId": "getPhotos",
        "summary": "List photos",
        "description": "Returns photos. Required scope: photos:read.",
        "tags": [
          "Photos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "photos:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Items to skip. Default 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Photo"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PageMeta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/photos/{id}": {
      "get": {
        "operationId": "getPhoto",
        "summary": "Get a photo",
        "description": "Returns one photo. Required scope: photos:read.",
        "tags": [
          "Photos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-required-scope": "photos:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The photo id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Photo"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid X-API-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not owned by the key's account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "API key, for example loki_..."
      }
    },
    "schemas": {
      "Pet": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "1 to 100 characters."
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "1 to 500 characters."
          },
          "type": {
            "type": "string",
            "description": "For example dog or cat."
          },
          "breed": {
            "type": "string",
            "maxLength": 100,
            "description": "Up to 100 characters."
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "description": "Date of birth."
          },
          "weight": {
            "type": "string",
            "description": "A string with its unit, for example \"28kg\"."
          },
          "sex": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "unknown"
            ],
            "description": "male, female or unknown."
          }
        }
      },
      "CareItem": {
        "type": "object",
        "required": [
          "id",
          "title",
          "itemType",
          "startsAt",
          "petIds"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "1 to 200 characters."
          },
          "itemType": {
            "type": "string",
            "enum": [
              "feeding",
              "medication",
              "vet_visit",
              "grooming",
              "exercise",
              "other"
            ],
            "description": "feeding, medication, vet_visit, grooming, exercise or other."
          },
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the item starts."
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the item ends."
          },
          "allDay": {
            "type": "boolean",
            "default": false,
            "description": "Default false."
          },
          "description": {
            "type": "string",
            "description": "Free text."
          },
          "petIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The pets this item is for."
          },
          "recurrenceType": {
            "type": "string",
            "enum": [
              "once",
              "daily",
              "weekly",
              "monthly"
            ],
            "default": "once",
            "description": "once (default), daily, weekly or monthly."
          },
          "recurrenceInterval": {
            "type": "integer",
            "description": "For example 2 with weekly means every two weeks."
          },
          "recurrenceEndDate": {
            "type": "string",
            "format": "date-time",
            "description": "When the recurrence stops."
          },
          "reminderEnabled": {
            "type": "boolean",
            "default": false,
            "description": "Default false."
          },
          "reminderLeadMinutes": {
            "type": "integer",
            "description": "Minutes before the item to send the reminder."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "For example dosage or clinicName."
          }
        }
      },
      "JournalEntry": {
        "type": "object",
        "required": [
          "id",
          "petId",
          "title",
          "content",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "petId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Photo": {
        "type": "object",
        "required": [
          "id",
          "petId",
          "url",
          "caption"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "petId": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "caption": {
            "type": "string"
          }
        }
      },
      "PageMeta": {
        "type": "object",
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "invalid_request",
              "unauthorized",
              "forbidden",
              "not_found",
              "rate_limited",
              "server_error"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}
