Skip to content

Internal API

SlashDB possess an internal API that can be used for automated configuration management. Using different endpoints, you can create, modify, or delete:

This functionality is only available for authenticated users.

Info

All of these operations can be done using your preferred HTTP request library or simply curl.

You can also use the SlashDB Javascript SDK or the SlashDB React SDK to send requests to these endpoints.

Note that the internal API is only available in JSON format.

Database Configuration API

This API allows you to update the SlashDB database configuration. It is located at /dbdef.json.

List

Retrieve the list of database configurations.

curl example:

# get list
curl https://demo.slashdb.com/dbdef.json -H 'apikey: validuserapikey' -i

Get

Retrieve a database configuration.

# get single query
curl https://demo.slashdb.com/dbdef/MyNewDB.json -H 'apikey: validuserapikey' -i

Create

Create a database configuration.

curl example:

curl https://demo.slashdb.com/dbdef.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPOST -d \
'{
    "db_id": "MyNewDB",
    "db_encoding": "utf-8",
    "owners": [
        "admin"
    ],
    "creator": "admin",
    "read": [],
    "editable": true,
    "db_type": "sqlite",
    "executable": true,
    "autoload_user": {
        "dbuser": "",
        "dbpass": ""
    },
    "autoload": true,
    "viewable": true,
    "write": [],
    "connection": "/my/path/MyNewDB.sqlite",
    "foreign_keys": {},
    "execute": [],
    "db_schema": null,
    "autoconnect": true,
    "alternate_key": {},
    "excluded_columns": {},
    "desc": "New SQLite database"
}'

# returns
HTTP/1.1 201 Created
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 12:14:15 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 116
Connection: keep-alive
Location: https://demo.slashdb.com/dbdef/MyNewDB.json
Access-Control-Allow-Origin: *

https://demo.slashdb.com/dbdef/MyNewDB.json

Update

Update a database configuration.

curl example:

curl https://demo.slashdb.com/dbdef/MyNewDB.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPUT -d \
'{"autoload": false}'

# returns
HTTP/1.1 204 No Content
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 13:38:31 GMT
Connection: keep-alive
Location: https://demo.slashdb.com/dbdef/MyNewDB.json
Access-Control-Allow-Origin: *

Delete

Delete a database configuration.

curl example:

curl https://demo.slashdb.com/dbdef/MyNewDB.json -i \
-H 'apikey: validuserapikey' -XDELETE

# returns
HTTP/1.1 204 No Content
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 13:42:08 GMT
Connection: keep-alive
Access-Control-Allow-Origin: *

User Configuration API

This API allows you to update the SlashDB user configuration. It is located at /userdef.json.

List

Retrieve the list of user configurations.

curl example:

# get list
curl https://demo.slashdb.com/userdef.json -i \
-H 'apikey: validuserapikey'

Get

Retrieve a user configuration.

# get single query
curl https://demo.slashdb.com/userdef/MyNewUser.json -i \
-H 'apikey: validuserapikey'

Create

Create a new user configuration.

curl example:

curl https://demo.slashdb.com/userdef.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPOST -d \
'{
    "user_id": "MyNewUser",
    "userdef": [],
    "api_key": "new-user-api-key",
    "name": "",
    "creator": "admin",
    "edit": [],
    "dbdef": [],
    "querydef": [],
    "databases": {
        "Chinook": {
            "dbuser": "",
            "dbpass": ""
        }
    },
    "password": "newpasswd",
    "email": "",
    "view": []
}'

# returns
HTTP/1.1 201 Created
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 14:45:04 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 116
Connection: keep-alive
Location: https://demo.slashdb.com/userdef/MyNewUser.json
Access-Control-Allow-Origin: *

https://demo.slashdb.com/userdef/MyNewUser.json

Update

Update a user configuration.

curl example:

curl https://demo.slashdb.com/userdef/MyNewUser.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPUT -d \
'{"name": "John"}'

# returns
HTTP/1.1 204 No Content
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 14:43:28 GMT
Connection: keep-alive
Location: https://demo.slashdb.com/userdef/MyNewUser.json
Access-Control-Allow-Origin: *

Delete

Delete a user configuration.

curl example:

curl https://demo.slashdb.com/userdef/MyNewUser.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XDELETE

# returns
HTTP/1.1 204 No Content
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 14:44:03 GMT
Connection: keep-alive
Access-Control-Allow-Origin: *

Query Configuration API

This API allows you to update the SlashDB query configuration. It is located at /querydef.json.

List

Retrieve the list of query configurations.

curl example:

# get list
curl https://demo.slashdb.com/querydef.json -i \
-H 'apikey: validuserapikey'

Get

Retrieve a query configuration.

# get single query
curl https://demo.slashdb.com/querydef/MyNewQuery.json -i \
-H 'apikey: validuserapikey'

Create

Create a query configuration.

curl example:

curl https://demo.slashdb.com/querydef.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPOST -d \
'{
    "query_id": "MyNewQuery",
    "creator": "admin",
    "read": [
        "admin"
    ],
    "database": "Chinook",
    "execute": [
        "admin",
        "public"
    ],
    "write": [
        "admin"
    ],
    "http_methods": {
        "GET": true
    },
    "sqlstr": "select * from Customer",
    "desc": "New Query Def"
}'

# returns
HTTP/1.1 201 Created
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 12:14:15 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 116
Connection: keep-alive
Location: https://demo.slashdb.com/querydef/MyNewQuery.json
Access-Control-Allow-Origin: *

https://demo.slashdb.com/querydef/MyNewQuery.json

Update

Update a query configuration.

curl example:

curl https://demo.slashdb.com/querydef/MyNewQuery.json -i \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPUT -d \
''{"http_methods": {"GET": true, "POST": true}}''

# returns
HTTP/1.1 204 No Content
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 13:38:31 GMT
Connection: keep-alive
Location: https://demo.slashdb.com/querydef/MyNewQuery.json
Access-Control-Allow-Origin: *

Delete

Delete a query configuration.

curl example:

curl https://demo.slashdb.com/querydef/MyNewQuery.json -i -XDELETE \
-H 'apikey: validuserapikey'

# returns
HTTP/1.1 204 No Content
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 02 Jun 2017 13:42:08 GMT
Connection: keep-alive
Access-Control-Allow-Origin: *

Database Credentials API

This API allows you to update the SlashDB database credentials. It is located at /dbcreds.json.

Important

Endpoints that perform operations on database credentials may include the database ID; see the examples below.

List

Retrieve the list of databases that have database credentials configured.

curl example:

# get list
curl https://demo.slashdb.com/dbcreds.json -H 'apikey: validuserapikey' -i

Get

Retrieve a single database credential.

Note

This endpoint includes the database ID of the database that the credential belongs to.

# get single credential
curl https://demo.slashdb.com/dbcreds/Chinook/ro_user.json -H 'apikey: validuserapikey' -i

Create

Create a credential for a given database.

Note

This endpoint ends with the database ID of the database you wish to create the credential for.

curl example:

curl https://demo.slashdb.com/dbcreds/Chinook.json \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'apikey: validuserapikey' -XPOST -d \
'{
    "dbc_id": "ro_user",
    "dbuser": "ro_account",
    "dbpass": "password",
    "view": [],
    "edit": [],
    "assign": []
}'

# returns
{"message": "\n\n\n\n\n", "code": "201 Created", "title": "Created"}

Update

Update a credential.

Note

This endpoint includes the database ID of the database that the credential belongs to.

curl example:

curl https://demo.slashdb.com/dbcreds/Chinook/ro_user.json \
-H 'Content-Type: application/json' \
-H 'apikey: validuserapikey' -XPUT -d \
'{"dbuser": "rw_user"}'

# returns the previous configuration, but the new configuration will be updated with the keys you specified
{
    "dbuser": "ro_user",
    "dbpass": "password",
    "view": [],
    "edit": [],
    "assign": []
}

Delete

Delete a credential.

Note

This endpoint includes the database ID of the database that the credential belongs to.

curl example:

curl https://demo.slashdb.com/dbcreds/Chinook/ro_user.json \
-H 'apikey: validuserapikey' -XDELETE

# returns empty, ro_user config is deleted

Request Status API

This API allows you to view the SlashDB request status entries. It is located at /reqstatus.json.

Note

This endpoint is read-only.

List

Get list of request statuses.

curl example:

curl https://demo.slashdb.com/reqstatus.json \
-H 'apikey: validuserapikey'

# request statuses

{
    "requests": {
        "9c47856b1d7e54801c4e984e2f66925d": {
            "method": "GET",
            "proc_id": "91:0242ac190002",
            "t_id": 139671558287360,
            "t_name": "uWSGIWorker1Core0",
            "path": "/db/pystreet/response_usd/desired_salary_usd/97996.0/years_experience/3.0.csv",
            "redir_path": null,
            "params": {
                "sort": "-desired_salary,-empl_type,ccy,-salary,response_id"
            },
            "resource": "response_usd",
            "query_id": null,
            "db_id": "pystreet",
            "user_id": "public",
            "http_status_code": 200,
            "err_msg": null,
            "timeout_msg": null,
            "data": [
                {
                    "status": "REQUEST_RCVD",
                    "ts": "2025-07-08T20:29:16.311524+00:00"
                },
                {
                    "status": "CHECK_REQUEST_AUTH",
                    "ts": "2025-07-08T20:29:16.312464+00:00"
                },
                {
                    "status": "REQUEST_PREPROCESS",
                    "ts": "2025-07-08T20:29:16.312569+00:00"
                },
                {
                    "status": "CREATE_DB_SESSION",
                    "ts": "2025-07-08T20:29:16.313878+00:00"
                },
                {
                    "status": "SQL_COMPILE",
                    "ts": "2025-07-08T20:29:16.316068+00:00"
                },
                {
                    "status": "SQL_EXEC",
                    "ts": "2025-07-08T20:29:16.316351+00:00"
                },
                {
                    "status": "RESULT_FETCH",
                    "ts": "2025-07-08T20:29:16.317876+00:00"
                },
                {
                    "status": "RESULT_ENCODE",
                    "ts": "2025-07-08T20:29:16.319198+00:00"
                },
                {
                    "status": "CREATE_RESPONSE",
                    "ts": "2025-07-08T20:29:16.319306+00:00"
                },
                {
                    "status": "COMPLETE",
                    "ts": "2025-07-08T20:29:16.319351+00:00"
                }
            ]
        },

    },
    "statusCodes": {
        "CLIENT_CLOSED_ERR": {
            "code": -300,
            "msg": "client closed the connection before full response was generated"
        },
        "ORPHANED_ERR": {
            "code": -502,
            "msg": "request orphaned, server process stopped responding (may be dead)"
        },
        "GW_TIMEOUT_ERR": {
            "code": -504,
            "msg": "request completed but cannot send response data back to client"
        },
        "ERR": {
            "code": -100,
            "msg": "error occurred, see log for details"
        },
        "COMPLETE": {
            "code": 0,
            "msg": "request completed"
        },
        "REQUEST_RCVD": {
            "code": 10,
            "msg": "receiving request"
        },
        "CHECK_REQUEST_AUTH": {
            "code": 20,
            "msg": "authorizing"
        },
        "REQUEST_PREPROCESS": {
            "code": 30,
            "msg": "preprocessing request"
        },
        "SCHEMA_TRAVERSE": {
            "code": 31,
            "msg": "analyzing schema"
        },
        "CREATE_DB_SESSION": {
            "code": 40,
            "msg": "creating database session"
        },
        "SQL_COMPILE": {
            "code": 50,
            "msg": "compiling SQL statement"
        },
        "SQL_EXEC": {
            "code": 60,
            "msg": "executing SQL statement"
        },
        "RESULT_FETCH": {
            "code": 70,
            "msg": "fetching results"
        },
        "RESULT_STREAM": {
            "code": 71,
            "msg": "streaming results"
        },
        "RESULT_ENCODE": {
            "code": 80,
            "msg": "encoding results"
        },
        "CREATE_RESPONSE": {
            "code": 90,
            "msg": "creating response"
        },
        "URL_REDIRECT": {
            "code": 300,
            "msg": "redirected"
        },
        "GW_TIMEOUT": {
            "code": 504,
            "msg": "gateway timeout"
        }
    },
    "okStatusLifetime": 28800,
    "errStatusLifetime": 604800
}