Back to articles list
- 2 minutes read

Vertabelo API

Generating a token

We've added an API to our Vertabelo application to help you incorporate some automation into your build system. Here is a short instruction on how to use the Vertabelo API.

First of all, you have to enable access to the API. You'll need have at least a "Basic" account plan or be a member of a company.

  1. Go to the My account page.
  2. Scroll down to the Settings section.
  3. Click Enable API access.
  4. You'll get a generated API token. This token will be used to identify you while connecting to the Vertabelo API.  Note that you may Disable API access here (and enable it again to get a new token).

Accessing data

The Vertabelo API functionality is simple and straightforward and consists of two functions.

  1. Fetch a database model as an XML file:
    https://my.vertabelo.com/api/xml/MODEL_ID
    or the version with a specific tag:
    https://my.vertabelo.com/api/xml/MODEL_ID/TAG_NAME
  2. Fetch SQL code that creates database tables and other entities:
    https://my.vertabelo.com/api/sql/MODEL_ID
    or the version with specific tag:
    https://my.vertabelo.com/api/sql/MODEL_ID/TAG_NAME

The Vertabelo API is a typical REST service. The API token must be passed as a user name with the password for your account.

For the API to work, you'll need to know the identifier of the model you want to fetch. The identifier can be found, after selecting the model, in the Details tab in the right panel:

Examples

To make this examples legible, we'll put our token, password, and model ID into the variables:

read -s -p "Token:"    TOKEN   ; echo; \
read -s -p "Password:" PASSWORD; echo; \
read -s -p "Model ID:" MODEL_ID; echo; \

You may copy all the shell scripts here right away, and try it yourself in your terminal – read will prompt you for the data.

Here is an example of how to fetch SQL from the command line:

curl \
  -u $TOKEN:$PASSWORD \
  https://my.vertabelo.com/api/sql/$MODEL_ID \
  > model-create-database.sql

Getting the XML definition of the model is similar:

curl \
  -u $TOKEN:$PASSWORD \
  https://my.vertabelo.com/api/xml/$MODEL_ID \
  > model.xml

As you can see, accessing the Vertabelo API is as simple as an HTTP request.

If you'd like to get access to other Vertabelo features, our support service is waiting for your ideas.

go to top