## User Data JSON Format

By sending JSON with a specific format to ReadMe (either through an oauth flow, or the user clicking a JWT link), you can tell ReadMe about your user and embed information about them directly in the documentation.

For more information about how to pass this data into ReadMe, read [Log Your Users In with a Custom Login Flow](🔗).

An example user object is defined below:

Any data that is passed into this object can be used as a variable. Though certain keys have specific meaning within ReadMe.

VariableUse in ReadMeRequired?
nameDisplay name in upper rightYes
emailEmail associated with user, used in support forum among other placesYes
isAdminAdds links to the dash, and allows access to disabled sectionsNo (default false)
isReadOnlyAllows user to access project with "Project Members Only" or "Site-wide password" access control turned on.No (default false)
apiKeyPrefills API key for OAuth authentication in API Reference (this is not the ReadMe project API key!)No
userPrefills Basic Auth username in the Authentication section of the API ReferenceNo
passPrefills Basic Auth password in the Authentication section of the API ReferenceNo
allowedProjectsArray of strings (subdomain) that you want to give access to. Or an array of objects with values { project: "subdomain", access: "readonly \| admin" }Yes
parametersObject of parameters present in the API Reference section. Values for keys entered here will be treated as default parameters in the API Reference.

## Using Variables in Documentation

The data passed in can be used as variables in the documentation. Just wrap the variable name with \<\<variable\>> to user's value, or the default if no value is set.

\<\<name\>> will be replaced with "Marc Cuva" in the docs.

If a user is not logged in, and OAuth Login is set up, there will be a prompt on the default variable for the user to log in.

## Defining Defaults in the API Reference

By adding the `parameters` object in the user object, you'll be able to pre-populate parameters on endpoints. Let's consider the following user object:

When the logged-in user with the above user data payload visits an endpoint in the API Reference section that has parameters with the IDs `x-readme-version` or `slug` present, for example, our Get Doc [endpoint](🔗), the parameters will be pre-filled with the values defined.

Single Project Support

Auto-populating parameters currently only works for single-project. It will not work if the `parameters` object is added within the `keys` array.

## Using Variables in API Reference Section

By setting specific variables in your user object, the API Reference section will automatically use those values when the user is logged in.

### OAuth and API Key Authentication

If `apiKey` is set in the passed in JSON object (like in the following example) and the API Reference section is using OAuth or API Key Authentication, the value will automatically be set.


OAuth token automatically set by `apiKey`

### Basic Auth

If the user object looks like this example, and the authentication is set to Basic Auth, the values will be automatically set the `user` and `pass`.


Basic Auth forms are filled from user object `user` and `pass`

### Multiple security schemes

As an alternative to the above, you can also pass in values to the user object that have the same name as your OAS Security Schemes. So for the following `securitySchemes`:

You can pass in a user object like this:

And all of your security inputs will be prefilled.

### One User with Multiple Projects

In some cases one user will have multiple sets of data. For example, a user can be apart of several teams all with a unique API Key. To support this functionality, just pass an array into a `keys` object with all of the values specific to that project.

When a variable that has multiple values is used in the documentation, for example \<\<key\>>, the variable will have a dropdown allowing the user to pick which of the projects they want to be active. This dropdown affects all of the variables on your site, so switching the current project on one variable will make sure all of the other ones remain consistent.


Project Switcher on a variable

## Using Variables in the GraphQL Explorer

By setting specific variables in your user object, the GraphQL Explorer section will automatically use those values when the user is logged in. See [GraphQL API Reference](🔗) for more information about how you can get access to the beta.

### OAuth Authentication

If `graphql` is set in the passed in JSON object (like in the following example), we will prefill in a `Bearer` `Authentication` header.