Skip to main content

Setting up your schema

Before you can put user data into Privy, you must set up your your schema - this means telling Privy what data (we call them fields) you will be accessing.

Data storage model

You can think of your Privy datastore as a table where each row represents one of your end users, the primary key for a row is the user_id (this is often a wallet address), and each column is a "field." See the table below:

All data in Privy is stored in a field and associated with a user_id.

Creating a field

Using the Privy Console

To create a new field in the console, navigate to the Fields tab and click on New Field. You'll see a modal like the one below come up.

Just give your field a name and description (the field's ID for use with the API is generated for you based on the name). On the right hand side, you can set the permissions for the field. If you're not sure how to manage permissions yet, don't worry - you can always change the permissions later! See the Permissions section of the docs for more information.

Using privy-node

You can also use privy-node to programmatically create a field.

import {PrivyClient} from '@privy-io/privy-node';
const client = new PrivyClient(process.env.PRIVY_API_KEY, process.env.PRIVY_API_SECRET);

const field = await client.createField({
name: 'my-field',
description: 'my-description',
default_access_group: 'self',

The call above creates a new field called my-field that only the self role can read or write.