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

# Rollup, RollupClient and Indexing

> Set up the SDK, then search, query, fill profiles and control indexing.

## Rollup

```swift theme={null}
public enum Rollup
```

<ResponseField name="sdkVersion" type="static let String">
  The SDK's version, such as `"0.1.0"`.
</ResponseField>

<ResponseField name="registerBackgroundTasks()" type="@MainActor static func">
  Registers the background processing task that keeps the index up to date (`<bundle ID>.rollup.update`). Call it before your app finishes launching, as iOS requires. It does nothing if your Info.plist does not permit that identifier.
</ResponseField>

<ResponseField name="configure(publishableKey:indexing:)" type="@MainActor static func throws">
  Sets up the SDK with your app's publishable key and what to index. Calling it again changes the options; the index follows them.

  <Expandable title="parameters">
    <ResponseField name="publishableKey" type="String" required>
      Your app's key from the developer dashboard. It must start with `rk_`.
    </ResponseField>

    <ResponseField name="indexing" type="IndexOptions" default="IndexOptions()">
      What to index. See [IndexOptions](/reference/index-options).
    </ResponseField>
  </Expandable>

  Throws `simulatorUnsupported` in the Simulator, `notConfigured` for a key that does not start with `rk_`, and `missingRequirement` naming each missing Info.plist entry. It cannot check for the App Attest capability: a missing capability shows when the device first registers, as `appAttestFailed`.
</ResponseField>

<ResponseField name="shared" type="@MainActor static let RollupClient">
  The client for every other call.
</ResponseField>

<ResponseField name="jsonEncoder" type="static var JSONEncoder">
  Encodes SDK results with ISO 8601 dates and sorted keys.
</ResponseField>

<ResponseField name="jsonDecoder" type="static var JSONDecoder">
  Decodes SDK results with ISO 8601 dates.
</ResponseField>

## RollupClient

```swift theme={null}
@MainActor public final class RollupClient
```

Use it through `Rollup.shared`. Every method except `requestPhotoAccess` throws `notConfigured` before `configure`, and `accessRevoked` while your app's access is stopped. `search`, `query` and `profile` throw `photoAccessDenied` while Photos access is denied or restricted.

<ResponseField name="indexing" type="Indexing">
  Indexing's state and control. See [Indexing](#indexing).
</ResponseField>

<ResponseField name="requestPhotoAccess()" type="async -> PhotoAccess">
  Shows iOS's Photos prompt, once. If the person grants access, the first index starts at once and continues in the background. Returns the person's answer, including `denied` and `restricted`; it does not throw.
</ResponseField>

<ResponseField name="search(_:)" type="async throws -> SearchResults">
  Searches the index on the iPhone: dates, places, media, and what photos show or say. Most relevant first. Throws `noIndex` when nothing is indexed yet. See [Search](/guides/search).
</ResponseField>

<ResponseField name="query(_:)" type="async throws -> Answer">
  Answers a question about the person's life from the index. The model runs on Rollup's server; its tools run on the iPhone, and only their text results leave it. See [Query](/guides/query).
</ResponseField>

<ResponseField name="profile(schema:)" type="async throws -> Profile">
  Fills a JSON Schema about the person from the index: the schema's shape exactly, `null` where their life does not say, with the photos behind each filled field. Takes the schema as JSON `Data` or as a [`JSONValue`](/reference/json-value). See [Profile](/guides/profile).
</ResponseField>

<ResponseField name="reset()" type="async throws">
  Deletes everything the SDK keeps: the index, downloaded models and place data, queued run reports, the device credential, and the device's record on Rollup's server. Indexing starts again from scratch when next started.
</ResponseField>

## Indexing

```swift theme={null}
@MainActor public final class Indexing
```

Use it through `Rollup.shared.indexing`.

<ResponseField name="state" type="IndexingState">
  Where indexing is now. See [IndexingState](/reference/indexing-state).
</ResponseField>

<ResponseField name="states" type="AsyncStream<IndexingState>">
  The current state, then every change after it.
</ResponseField>

<ResponseField name="start()" type="func">
  Starts indexing now, or brings the index up to date, and lets it continue in the background with the system progress UI. Call it from a person's action, such as a tap. A run that is already under way gains background continuation.
</ResponseField>

<ResponseField name="options" type="IndexOptions">
  What to index. Setting it changes the index in place on the next run, which starts shortly. See [Index options](/guides/index-options).
</ResponseField>

## PhotoAccess

```swift theme={null}
public enum PhotoAccess: String, Codable, Sendable {
    case authorized, limited, denied, restricted, notDetermined
}
```

The person's answer to the Photos prompt. With `limited`, the SDK indexes only the photos the person selected.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.