---
name: "readCategoryDataWithTypeSync"
mode: "kit"
versionRequirements:
  - { name: "HealthKit", version: "5.18.0" }
  - { name: "@ray-js/ray", version: "1.6.17" }
platform:
  - "iOS"
title: "health.readCategoryDataWithTypeSync - Read Category data [iOS only]"
---

## readCategoryDataWithTypeSync

> [VERSION] HealthKit >= 5.18.0 | @ray-js/ray >= 1.6.17

> [PLATFORM] iOS

### Description

Read Category health data by type and time range [iOS only]

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `permissions` | `string[]` | No | - | `5.18.3` | Permission types (used by the API to request read/write permissions). See the enum list below for possible values e.g., ["1","2"] |
| `readPermissions` | `string[]` | No | - | `5.18.3` | Read permission types (used by the API that checks whether the user has already authorized). See the enum list below for possible values e.g., ["1","2"] |
| `writePermissions` | `string[]` | No | - | `5.18.3` | Write permission types (used by the API that checks whether the user has already authorized). See the enum list below for possible values e.g., ["1","2"] |
| `writePermission` | `number` | No | - | `5.18.3` | Write permission type (used by the API that checks for write permission). See the enum list below for possible values |
| `value` | `number` | No | - | `5.18.3` | Value to write (the specific measurement value for Quantity or Category data) |
| `unitType` | `string` | No | - | `5.18.3` | Unit to pass in, such as "mg/dL", "g", "cm", "count"; required when querying or writing Quantity data For the unit corresponding to each data type, refer to Apple’s official HKTypeIdentifiers.h |
| `startTime` | `number` | No | - | `5.18.3` | Start time, Unix timestamp (seconds) |
| `endTime` | `number` | No | - | `5.18.3` | End time, Unix timestamp (seconds) |
| `type` | `number` | No | - | `5.18.3` | Data type to read/write (used by read/write APIs). See the enum list below for possible values |

### Error Codes

| Error Code | Error Message |
| --- | --- |
| `1` | AppleHealthParamsError |

### Examples

#### Basic usage

```tsx
import { health } from '@ray-js/ray'

const { readCategoryDataWithTypeSync } = health;

const result = readCategoryDataWithTypeSync({
  type: 1,
  startTime: 1700000000,
  endTime: 1700086400,
});
console.log('readCategoryDataWithTypeSync result', result.value);
```
