---
name: "updatePet"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.6.27" }
title: "updatePet - Update Pet"
---

## updatePet

> [VERSION] @ray-js/ray >= 1.6.27

### Description

Update pet information

### Parameters

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `Partial` | Yes | Request parameters: must include id, ownerId, and fields to update; see type PetUpdate for details |

##### Partial properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `ownerId` | `string` | No | - | Home ID |
| `petType` | `"cat" \| "dog"` | No | - | Pet type |
| `name` | `string` | No | - | Pet name, must not exceed 40 characters |
| `avatar` | `string` | No | - | Pet avatar path, must start with "smart/" |
| `sex` | `number` | No | - | Gender. 0 - female, 1 - male, 2 - spayed female, 3 - neutered male |
| `activeness` | `number` | No | - | Activity level: 0 - inactive, 1 - normal, 2 - very active |
| `birth` | `number` | No | - | Birthday, unit: milliseconds |
| `weight` | `number` | No | - | Weight, unit: g |
| `breedCode` | `string` | No | - | Breed code (obtain from the pet breed list API) |
| `rfid` | `string` | No | - | rfid |
| `id` | `number` | No | - | Pet ID |
| `devIds` | `string[]` | No | - | Associated device IDs |
| `foodId` | `number` | No | - | Associated main food ID |
| `extInfo` | `string` | No | - | Extra info; do not include sensitive data |
| `idPhotos` | `IdPhotos[]` | No | - | Front-facing photo |
| `features` | `Feature[]` | No | - | Pet feature code |
| `personalities` | `string[]` | No | - | Pet personality code |
| `timeZone` | `string` | No | - | Time zone |
| `dataType` | `string` | No | - | Business data type |


### Return Value

Type: `Promise<boolean>`

Promise; resolves to whether the update succeeded (boolean)

### Examples

#### Request example

```typescript
import { updatePet } from '@ray-js/ray';

updatePet({
  id: 1,
  ownerId: 'xxxx',
  petType: 'cat',
  name: 'Fubao',
  avatar: 'smart/xxxx/xxxx/xxxx',
  sex: 1,
  activeness: 1,
  birth: 1614528000000,
  weight: 5000,
  breedCode: 'xxx',
  idPhotos: [
    {
      angle: 'firstFront',
      objectKey: 'xxxx',
    },
  ],
  features: [
    {
      category: 'eyeColor',
      details: ['brown'],
    },
  ],
});
```

#### Response example

```json
true
```
