ArangoDB v3.13 is under development and not released yet. This documentation is not final and potentially incomplete.

HTTP interface for databases

The HTTP API for databases lets you create and delete databases, list available databases, and get information about specific databases

The HTTP interface for databases provides operations to create and drop individual databases. These are mapped to the standard POST and DELETE HTTP methods. There is also the GET method to retrieve an array of existing databases.

All database management operations can only be accessed via the default _system database and none of the other databases.

Addresses of databases

Any operation triggered via ArangoDB’s RESTful HTTP API is executed in the context of exactly one database. The database name is read from the first part of the request URI path (e.g. /_db/mydb/...). If the request URI does not contain a database name, it defaults to /_db/_system.

To explicitly specify the database in a request, the request URI must contain the database name at the beginning of the path:

http://localhost:8529/_db/mydb/...

The ... placeholder is the actual path to the accessed resource. In the example, the resource is accessed in the context of the mydb database. Actual URLs in the context of mydb could look like this:

http://localhost:8529/_db/mydb/_api/version
http://localhost:8529/_db/mydb/_api/document/test/12345
http://localhost:8529/_db/mydb/myapp/get
Database management operations like listing, creating, and dropping databases can only be executed with the _system database as the context.

Special characters in database names must be properly URL-encoded, e.g. a + b = c needs to be encoded as a%20%2B%20b%20%3D%20c:

http://localhost:8529/_db/a%20%2B%20b%20%3D%20c/_api/version

Database names containing Unicode must be properly NFC-normalized . Non-NFC-normalized names are rejected by the server.

Manage databases

Get information about the current database

GET /_db/{database-name}/_api/database/current

Retrieves the properties of the current database

The response is a JSON object with the following attributes:

  • name: the name of the current database
  • id: the id of the current database
  • path: the filesystem path of the current database
  • isSystem: whether or not the current database is the _system database
  • sharding: the default sharding method for collections created in this database
  • replicationFactor: the default replication factor for collections in this database
  • writeConcern: the default write concern for collections in this database
Path Parameters
  • The name of the database.

Query Parameters
    HTTP Headers
      Responses
      • is returned if the information was retrieved successfully.

      • is returned if the request is invalid.

      • is returned if the database could not be found.

      Examples

      curl --header 'accept: application/json' --dump - http://localhost:8529/_api/database/current
      Show output

      List the accessible databases

      GET /_db/{database-name}/_api/database/user
      Retrieves the list of all databases the current user can access without specifying a different username or password.
      Path Parameters
      • The name of a database. Which database you use doesn’t matter as long as the user account you authenticate with has at least read access to this database.

      Query Parameters
        HTTP Headers
          Responses
          • is returned if the list of database was compiled successfully.

          • is returned if the request is invalid.

          Examples

          curl --header 'accept: application/json' --dump - http://localhost:8529/_api/database/user
          Show output

          List all databases

          GET /_db/_system/_api/database

          Retrieves the list of all existing databases

          Retrieving the list of databases is only possible from within the _system database.
          Responses
          • is returned if the list of database was compiled successfully.

          • is returned if the request is invalid.

          • is returned if the request was not executed in the _system database.

          Examples

          curl --header 'accept: application/json' --dump - http://localhost:8529/_api/database
          Show output

          Create a database

          POST /_db/_system/_api/database

          Creates a new database.

          The response is a JSON object with the attribute result set to true.

          Creating a new database is only possible from within the _system database.
          Request Body application/json object
          • Has to contain a valid database name. The name must conform to the selected naming convention for databases. If the name contains Unicode characters, the name must be NFC-normalized . Non-normalized names will be rejected by arangod.

          • Optional object which can contain the following attributes:

            • Default replication factor for new collections created in this database. Special values include “satellite”, which will replicate the collection to every DB-Server (Enterprise Edition only), and 1, which disables replication. (cluster only)

            • The sharding method to use for new collections in this database. Valid values are: “”, “flexible”, or “single”. The first two are equivalent. (cluster only)

            • Default write concern for new collections created in this database. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

              For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the --cluster.write-concern startup option, which defaults to 1. (cluster only)

          • An array of user objects. The users will be granted Administrate permissions for the new database. Users that do not exist yet will be created. If users is not specified or does not contain any users, the default user root will be used to ensure that the new database will be accessible after it is created. The root user is created with an empty password should it not exist. Each user object can contain the following attributes:

            • A flag indicating whether the user account should be activated or not. The default value is true. If set to false, then the user won’t be able to log into the database. The default is true. The attribute is ignored for users that already exist.

            • A JSON object with extra user information. It is used by the web interface to store graph viewer settings and saved queries. Should not be set or modified by end users, as custom attributes will not be preserved.

            • The user password as a string. If not specified, it will default to an empty string. The attribute is ignored for users that already exist.

            • Login name of an existing user or one to be created.

          Responses
          • is returned if the database was created successfully.

          • is returned if the request parameters are invalid, if a database with the specified name already exists, or if the configured limit to the number of databases has been reached.

          • is returned if the request was not executed in the _system database.

          • is returned if a database with the specified name already exists.

          Examples

          Creating a database named example.

          curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/database
          {
            "name": "example",
            "options": {
              "sharding": "flexible",
              "replicationFactor": 3
            }
          }
          Show output

          Creating a database named mydb with two users, flexible sharding and default replication factor of 3 for collections that will be part of the newly created database.

          curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/database
          {
            "name": "mydb",
            "users": [
              {
                "username": "admin",
                "passwd": "secret",
                "active": true
              },
              {
                "username": "tester",
                "passwd": "test001",
                "active": false
              }
            ]
          }
          Show output

          Drop a database

          DELETE /_db/_system/_api/database/{database-name}

          Drops the database along with all data stored in it.

          Dropping a database is only possible from within the _system database. The _system database itself cannot be dropped.
          Path Parameters
          • The name of the database

          Query Parameters
            HTTP Headers
              Responses
              • is returned if the database was dropped successfully.

              • is returned if the request is malformed.

              • is returned if the request was not executed in the _system database.

              • is returned if the database could not be found.

              Examples

              curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/database/example
              Show output