---
name: "getPetList"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.6.27" }
title: "getPetList - Get pet list."
---

## getPetList

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

### Description

Get pet list

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `GetPetList` | Yes | Request parameters: ownerId (home ID); bizTypes (optional, internally fixed to pet center business) |

### Return Value

Type: `Promise<Pet[]>`

Promise; resolves to the list of pets under the current home (GetPetListResult)

##### Pet

| Property | Type | Description |
| --- | --- | --- |
| `ownerId` | `string` | Home ID |
| `petType` | `"cat" \| "dog"` | Pet type |
| `name` | `string` | Pet name, must not exceed 40 characters |
| `avatar` | `string` | Pet avatar path, must start with "smart/" |
| `sex` | `number` | Gender. 0 - female, 1 - male, 2 - spayed female, 3 - neutered male |
| `activeness` | `number` | Activity level: 0 - inactive, 1 - normal, 2 - very active |
| `birth` | `number` | Birthday, unit: milliseconds |
| `weight` | `number` | Weight, unit: g |
| `breedCode` | `string` | Breed code (obtain from the pet breed list API) |
| `rfid` | `string` | rfid |
| `id` | `number` | Pet ID |
| `avatarDisplay` | `string` | Accessible path for pet avatar |
| `extInfo` | `string` | Extra info; do not include sensitive data |
| `breedName` | `string` | Breed name |
| `gmtCreate` | `number` | Creation timestamp, in milliseconds |
| `gmtModified` | `number` | Update timestamp, in milliseconds |
| `bindFood` | `boolean` | Whether pet food is linked |

### Referenced Types

##### `type` GetPetList

| Property | Type | Description |
| --- | --- | --- |
| `ownerId` | `string` | Home ID |
| `bizTypes` | `number[]` | Business type: 1 - Pet Center, 2 - Pet AI, default 1 |


### Examples

#### Request example

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

getPetList({
  ownerId: 'xxxx',
  bizTypes: [2],
});
```

#### Response example

```json
[
  {
    "id": 1,
    "ownerId": "xxxx",
    "petType": "cat",
    "name": "Fubao",
    "avatar": "smart/xxxx/xxxx/xxxx",
    "avatarDisplay": "https://xxx/xxx",
    "sex": 1,
    "activeness": 1,
    "birth": 1614528000000,
    "weight": 5000,
    "breedCode": "xxx",
    "breedName": "Chinchilla",
    "rfid": "xxxxx",
    "extInfo": "",
    "bindFood": false,
    "gmtCreate": 1740792022716,
    "gmtModified": 1741785184589
  }
]
```
