Managing repositories and locations via the GraphDB REST API

You can use use cURL command to perform basic location and repository management through the GraphDB REST API. This includes connecting to remote GraphDB instances (locations), activating a location, and different ways for creating a repository.


  • One or optionally two machines with Java.

  • One GraphDB instance:

    • Start GraphDB on the first machine.


      For more information on deploying GraphDB, please see How to install GraphDB.

  • Another GraphDB instance (optional, needed for the Attaching a remote location example):

    • Start GraphDB on the second machine.

  • The cURL command line tool for sending requests to the API.


Throughout this document, the two instances will be referred to with the following URLs:

  • for the first instance;

  • for the second instance.

Please adjust the URLs according to the IPs or hostnames of your own machines.

Managing repositories

Create a repository

Repositories can be created by providing a .ttl file with all the configuration parameters.

  1. Download the sample repository config file repo-config.ttl.

  2. Send the file with a POST request using the following cURL command:

    curl -X POST\\
        -H 'Content-Type: multipart/form-data'\
        -F "config=@repo-config.ttl"


You can provide a parameter location to create a repository in another location, see Managing locations below.

List repositories

Use the following cURL command to list all repositories by sending a GET request to the API:

curl -G\
    -H 'Accept: application/json'

The output shows the repository repo1 that was created in the previous step.

      "title":"my repository number one",

Managing locations

Attach a location

Use the following cURL command to attach a remote location by sending a PUT request to the API:

curl -X PUT\
    -H 'Content-Type:application/json'\
    -d '{
        "uri": "",
        "username": "admin",
        "password": "root"


The username and password are optional.

List locations

Use the following cURL command to list all locations that are attached to a machine by sending a GET request to the API:

    -H 'Accept: application/json'

The output shows one local and one remote location:

      "system" : true,
      "errorMsg" : null,
      "active" : false,
      "defaultRepository" : null,
      "local" : true,
      "username" : null,
      "uri" : "",
      "password" : null,
      "label" : "Local"
      "system" : false,
      "errorMsg" : null,
      "active" : true,
      "defaultRepository" : null,
      "local" : false,
      "username" : "admin",
      "uri" : "",
      "password" : "root",
      "label" : "Remote ("


If you skipped the “Attaching a remote location” step or if you already had other locations attached, the output will look different.

Detach a location

Use the following cURL command to detach a location from a machine by sending a DELETE request to the API:

  • To detach the remote location

    curl -G -X DELETE\
        -H 'Content-Type:application/json'\
        -d uri=


Detaching a location simply removes it from the Workbench and will not delete any data. A detached location can be re-attached at any point.

Further reading

For a full list of request parameters and more information regarding sending requests, check the REST API documentation within the GraphDB Workbench accessible from the Help ‣ REST API menu.