# Pets API

Source: https://frameleaf.app/docs/api/reference/pets/

Use your own server and its scoped API keys.

## Retrieve pets

GET /api/pets

Retrieve the signed-in account’s pet identities.

```json
{
  "description": "Retrieve the signed-in account’s pet identities.",
  "operationId": "getAllPets",
  "parameters": [
    {
      "name": "withHidden",
      "required": false,
      "in": "query",
      "description": "Include hidden pets",
      "schema": {
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/PetResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve pets",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Create a pet

POST /api/pets

Create a durable pet identity with a name, species and optional birthday.

```json
{
  "description": "Create a durable pet identity with a name, species and optional birthday.",
  "operationId": "createPet",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PetCreateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Create a pet",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Accept a pet recognition candidate

POST /api/pets/candidates/{id}/accept

Record a durable confirmed observation for the proposed pet, or for a different pet when one is supplied.

```json
{
  "description": "Record a durable confirmed observation for the proposed pet, or for a different pet when one is supplied.",
  "operationId": "acceptPetCandidate",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PetCandidateReviewDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetObservationResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Accept a pet recognition candidate",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Reject a pet recognition candidate

POST /api/pets/candidates/{id}/reject

Record a durable rejection so the proposal does not return after the model is rerun.

```json
{
  "description": "Record a durable rejection so the proposal does not return after the model is rerun.",
  "operationId": "rejectPetCandidate",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PetCandidateRejectDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetObservationResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Reject a pet recognition candidate",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Retrieve the pet observations of an asset

GET /api/pets/observations

Retrieve the signed-in account’s decisions about which of its pets appear in one asset.

```json
{
  "description": "Retrieve the signed-in account’s decisions about which of its pets appear in one asset.",
  "operationId": "getAssetPetObservations",
  "parameters": [
    {
      "name": "assetId",
      "required": true,
      "in": "query",
      "description": "Asset whose pet observations to list",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/PetObservationResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve the pet observations of an asset",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Remove a pet observation

DELETE /api/pets/observations/{id}

Undo a durable observation, whether it was drawn by hand or made in review. With `expectedChecksum`, refused with 409 when the original changed.

```json
{
  "description": "Undo a durable observation, whether it was drawn by hand or made in review. With `expectedChecksum`, refused with 409 when the original changed.",
  "operationId": "deletePetObservation",
  "parameters": [
    {
      "name": "expectedChecksum",
      "required": false,
      "in": "query",
      "description": "Checksum of the original the decision was made on (base64); refused with 409 when it changed",
      "schema": {
        "minLength": 1,
        "maxLength": 200,
        "type": "string"
      }
    },
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Remove a pet observation",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Delete a pet

DELETE /api/pets/{id}

Delete a pet identity and every observation recorded for it.

```json
{
  "description": "Delete a pet identity and every observation recorded for it.",
  "operationId": "deletePet",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete a pet",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Retrieve a pet

GET /api/pets/{id}

Retrieve a single pet identity.

```json
{
  "description": "Retrieve a single pet identity.",
  "operationId": "getPet",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve a pet",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Update a pet

PUT /api/pets/{id}

Update a pet’s name, species, birthday, featured photo, hidden or favorite state.

```json
{
  "description": "Update a pet’s name, species, birthday, featured photo, hidden or favorite state.",
  "operationId": "updatePet",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PetUpdateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Update a pet",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Merge pets

POST /api/pets/{id}/merge

Merge other pet identities into this one, keeping every durable observation.

```json
{
  "description": "Merge other pet identities into this one, keeping every durable observation.",
  "operationId": "mergePets",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PetMergeDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Merge pets",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Retrieve pet observations

GET /api/pets/{id}/observations

Retrieve the durable observations recorded for a pet.

```json
{
  "description": "Retrieve the durable observations recorded for a pet.",
  "operationId": "getPetObservations",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/PetObservationResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve pet observations",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```

## Add a pet observation

POST /api/pets/{id}/observations

Record by hand that a pet appears in an asset, optionally with a drawn region.

```json
{
  "description": "Record by hand that a pet appears in an asset, optionally with a drawn region.",
  "operationId": "createPetObservation",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PetObservationCreateDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PetObservationResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Add a pet observation",
  "tags": [
    "Pets"
  ],
  "x-frameleaf-permission": "all"
}
```
