## Basic Format

We Accept JSON!

ReadMe's API, [OAuth](🔗), [JWT](🔗), and [Personalized Docs Webhook](🔗) consume [JSON](🔗).

By sending a specific format, you can describe your user to ReadMe and embed information about them directly in your documentation. Any data that is passed can be used as a variable.

An example user object is defined below:

## ReadMe-Specific Variables

While you can define any variable within your documentation, certain variables have specific meaning within ReadMe.

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

## Referencing 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. For example, using the above payload, `<<name>>` will be replaced with "Owlbert" in your documentation.

## 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 with your API

By setting specific variables in your user object, authentication fields will automatically use those values when a user logs 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.