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

## getPetDetail

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

### Description

Get pet details

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `GetPetDetail` | Yes | Request parameters: ownerId (home ID), id (pet ID) |

### Return Value

Type: `Promise<PetDetail>`

Promise; resolves to pet details (PetDetail)

##### PetDetail

| 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 |
| `breedName` | `string` | Breed name |
| `extInfo` | `string` | Extra info; do not include sensitive data |
| `personalities` | `string[]` | Pet personality code |
| `idPhotos` | `IdPhotos[]` | Front-facing photo |
| `features` | `Feature[]` | Pet feature code |
| `devIds` | `string[]` | Associated device IDs |
| `relationFood` | `Object` | Associated main food information |
| `weightType` | `0 \| 1 \| 2` | Body condition: 0 - underweight, 1 - normal, 2 - overweight (requires associated main food, breed, etc.) |
| `dailyCalorie` | `number` | Daily recommended calories, unit: Kcal (requires associated main food, breed, etc.) |
| `dailyFeeding` | `number` | Daily recommended feeding amount, unit: g (requires associated main food, breed, etc.) |
| `gmtCreate` | `number` | Creation timestamp, in milliseconds |
| `gmtModified` | `number` | Update timestamp, in milliseconds |

##### PetDetail.relationFood properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | `number` | Yes | - | Main food ID |
| `name` | `string` | Yes | - | Main food name |


### Referenced Types

##### `type` GetPetDetail

| Property | Type | Description |
| --- | --- | --- |
| `ownerId` | `string` | Home ID |
| `id` | `number` | Pet ID |

##### `type` IdPhotos

| Property | Type | Description |
| --- | --- | --- |
| `angle` | `string` |  |
| `objectKey` | `string` |  |
| `display` | `string` |  |

##### `type` Feature

| Property | Type | Description |
| --- | --- | --- |
| `category` | `string` |  |
| `details` | `string[]` |  |

##### `type` Images

| Property | Type | Description |
| --- | --- | --- |
| `imageDisplayUrl` | `string` |  |
| `objectKey` | `string` |  |
| `angle` | `string` |  |
| `desc` | `string` |  |


### Examples

#### Request example

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

getPetDetail({
  ownerId: 'xxxx',
  id: 1,
});
```

#### 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": "",
  "idPhotos": [
    {
      "angle": "firstFront",
      "display": "https://xxx/xxx",
      "objectKey": "xxxx"
    }
  ],
  "features": [
    {
      "category": "eyeColor",
      "details": ["brown"]
    }
  ],
  "personalities": ["independent"],
  "relationFood": {
    "id": 22,
    "name": "xxx"
  },
  "weightType": 1,
  "dailyCalorie": 62.7,
  "dailyFeeding": 191,
  "gmtCreate": 1740792022716,
  "gmtModified": 1741785184589
}
```
