You are currently browsing legacy 2.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Using API Keys With RavenDB

Api keys are used when trying to authorize with OAuth.

Here are the steps needed in order to set the api keys:

1) Open the browser
2) Navigate to: http://localhost:{your server port}
3) Go to the Databases section and select "System Database" on the top right
Select System Database
4) Go to the settings (press the cog wheel next to the database name)
Go to the Settings
5) In the Api Keys section Add a new key, select a name, generate a secret and add a database for your database
Add New API Key
6) Don't forget to click the "Save Changes" button"
Save Changes

A few tips:

  • In order to set a key to all databases in the database name enter "*" (this will NOT grant access to the system database)
  • To grant access to the system database set the database name to "<system>".

Once all settings are entered give the user the "full api key" (you can right-click on it to copy).
Copy API Key to Clipboard

In order to use this api key the user needs to set the api key when settings a new DocumentStore like this:

var store = new DocumentStore
	                       {
		                       Url = "http://localhost:" + port,
		                       DefaultDatabase = "ApiKeySample",
		                       ApiKey = apiKey
	                       }.Initialize();