Setup

To create user wallets that integrate directly with your JWT-based authentication system, first configure your app’s JWT-based authentication settings in the dashboard. The User Signer API uses this configuration to verify the legitimacy of user JWTs.

Create a wallet with a user signer

Once you have configured your custom JWT authentication in the dashboard, your application can create a user wallet by calling the /v1/wallets_with_recovery endpoint with your user’s JWT subject ID. This endpoint will create a wallet that can be accessed using the associated user JWT.

Request

The request to /v1/wallets_with_recovery contains the following parameters.

primary_signer
object
required
wallets
array
required
recovery_user
object
required

Response

The response from the endpoint will contain the following fields.

wallets
object[]
required

The wallet that was created.

recovery_user_id
string
required

The ID of the created user.

Example

An example request to /v1/wallets_with_recovery may have the following parameters.

curl -X POST https://api.privy.io/v1/wallets_with_recovery \
  -u "<your-privy-app-id>:<your-privy-app-secret>" \
  -H "privy-app-id: <your-privy-app-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "primary_signer": {
      "subject_id": "<jwt-subject-id>"
    },
    "wallets": [{
      "chain_type": "<chain-type>"
    }],
    "recovery_user": {
      // Must include at least one of these or one of each.
      "linked_accounts": [
        {
          "type": "<email>",
          "address": "<recovery-account-address>"
        },
        {
          "type": "<custom-auth>",
          "custom_user_id": "<custom-user-id>"
        }
      ]
    }
  }'

A successful response will look like the following.

{
  "wallets": [
    {
      "id": "<wallet-id>",
      "chain_type": "ethereum",
      "address": "<wallet-address>",
      "owner_id": "<owner-id>"
    }
  ],
  "recovery_user_id": "<recovery-user-id>"
}