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

# Setup

> Configure the Privy Ruby SDK client with app credentials and authorization context for backend operations.

## Prerequisites

Before getting started:

* Obtain a [Privy app ID and app secret](https://docs.privy.io/basics/get-started/dashboard/create-new-app.md) from the Privy Dashboard
* Install Ruby 3.2.0 or later

## Instantiating the `PrivyClient`

Require the `privy` gem and create a new client instance by passing the Privy **app ID** and
**app secret** as parameters.

```ruby theme={"system"}
require "privy"

client = Privy::PrivyClient.new(
  app_id: "your-privy-app-id",
  app_secret: "your-app-secret"
)
```

This `client` is the entry point for managing Privy resources from a server. The `PrivyClient`
provides services for creating wallets, signing and sending transactions, retrieving user objects,
verifying auth tokens, and managing policies and key quorums.

> [!TIP]
>
> The `app_id` and `app_secret` arguments default to the `PRIVY_APP_ID` and `PRIVY_APP_SECRET`
> environment variables, so they can be omitted if those variables are set.

## Authorization

If a resource (i.e. wallet, policy, or key quorum) has an [owner](https://docs.privy.io/controls/authorization-keys/using-owners/overview.md),
[authorization signatures](https://docs.privy.io/api-reference/authorization-signatures.md) from the owner are required.
The [authorization context](https://docs.privy.io/controls/authorization-keys/using-owners/sign/signing-on-the-server.md) accepts authorization private keys
and user JWTs of the wallet's owners. The Ruby SDK generates signatures and signs requests
automatically.

> [!TIP]
>
> Review the [signing on the
> server](https://docs.privy.io/controls/authorization-keys/using-owners/sign/signing-on-the-server.md) guide before using
> the Ruby SDK for the best development experience.

```ruby theme={"system"}
ctx = Privy::Authorization::AuthorizationContext.build(
  authorization_private_keys: ["privateKey1", "privateKey2"],
  user_jwts: ["jwt1", "jwt2"]
)
```

## Rate limits

Privy rate limits REST API endpoints called from a server.

> [!TIP]
>
> Learn more about optimizing request patterns and handling rate limits in the
> [optimizing](https://docs.privy.io/recipes/dashboard/optimizing.md) guide.

## Next steps

> [card] [Quickstart](https://docs.privy.io/basics/ruby/quickstart.md)
>
> Create wallets, sign messages, and send transactions with the Ruby SDK.

> [card] [Authorization keys](https://docs.privy.io/controls/authorization-keys/overview.md)
>
> Add an extra layer of security by signing requests with authorization keys.
