> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clariodesk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native API reference

> The headless public surface of the React Native SDK.

All methods live on the `ClarioDesk` singleton. `subscribe*` methods return an
unsubscribe function; the React `hooks` mirror each subscription.

```ts theme={null}
import { ClarioDesk } from '@clariodesk/react-native';
```

## Lifecycle

```ts theme={null}
ClarioDesk.init({ apiKey, identityTokenProvider?, pushTokenProvider?, attachments? }): Promise<void>
ClarioDesk.identify({ externalId?, name?, email?, traits?, identityToken?, identityMode? }): Promise<void>
ClarioDesk.deviceThumbprint(): Promise<string>
ClarioDesk.clearIdentity(): Promise<void>
ClarioDesk.reset(): Promise<void>
ClarioDesk.isInitialized(): boolean
ClarioDesk.isIdentified(): boolean
```

Without a token, `identify` writes unverified display labels. With a token or
provider it performs [Verified identity](/concepts/verified-identity). Use
`clearIdentity()` before verified logout/switch; `reset()` deprovisions only
this installation.

## Tickets & messages

```ts theme={null}
ClarioDesk.createTicket({ subject, body, attachments? }): Promise<{ ticket: Ticket }>
ClarioDesk.sendMessage(ticketId, body, { attachments? }?): Promise<Message>
ClarioDesk.retryMessage(message): Promise<Message>   // for failed optimistic sends
ClarioDesk.markRead(ticketId): Promise<void>
ClarioDesk.setTyping(ticketId, isTyping): void
ClarioDesk.fetchTickets(): Promise<Ticket[]>          // one-shot
ClarioDesk.fetchTicket(ticketId): Promise<Ticket>     // one-shot
```

A message with `pending: true` is optimistic; `failed: true` means rejected, so
render tap-to-retry with `retryMessage`. Offline sends stay pending and
auto-flush on reconnect.

## Live subscriptions

Each returns an unsubscribe function.

```ts theme={null}
ClarioDesk.subscribeTickets(cb): () => void
ClarioDesk.subscribeMessages(ticketId, cb): () => void
ClarioDesk.subscribeTyping(ticketId, cb): () => void
ClarioDesk.subscribeAgentPresence(cb): () => void
ClarioDesk.subscribeConnection(cb): () => void   // connecting | connected | reconnecting | disconnected | fatal
ClarioDesk.subscribeSync(cb): () => void
ClarioDesk.subscribeState(cb): () => void
ClarioDesk.subscribePushOpened(cb): () => void
```

### Hooks

The same data, idiomatic for React (separate entry, no React dep in core):

```ts theme={null}
import {
  useTickets, useMessages, useTyping, useAgentPresence,
  useConnection, useSync, usePushOpened,
} from '@clariodesk/react-native/hooks';
```

## CSAT

```ts theme={null}
ClarioDesk.submitCsat(ticketId, { score, comment? }): Promise<void>
// score: 1 (😔) … 5 (😄)
```

## Push

```ts theme={null}
ClarioDesk.registerPushToken(token): Promise<void>
ClarioDesk.isClarioMessage(data): boolean
ClarioDesk.parsePushPayload(data): ParsedPush | null
ClarioDesk.openTicketFromPush(data): void
ClarioDesk.getNotificationPreferences(): Promise<NotificationPreferences>
ClarioDesk.setNotificationPreferences(prefs): Promise<void>
```

See the [push guide](/react-native/push).

## Attachments

```ts theme={null}
ClarioDesk.attachmentUploadProgress(stubId): Subscribable<number>
ClarioDesk.refreshAttachmentUrl(attachmentId): Promise<Attachment>
```

## Types

All types are exported: `Ticket`, `Message`, `Attachment`, `OutgoingAttachment`,
`readStateOf`, `ClarioDeskError`, and the enums above.

<Note>
  This surface mirrors the [Flutter SDK](/flutter/api-reference) 1:1. Same method
  names, same semantics. The [Swift SDK](/swift/api-reference) implements the
  same contract in Swift idioms. If a capability behaves differently across the
  SDKs, it's a bug.
</Note>
