Authentication

EndpointPOST /v1/auth/login
Servicehttps://api.bytebase.com/#bytebase.v1.AuthService
Requesthttps://api.bytebase.com/#bytebase.v1.LoginRequest
Responsehttps://api.bytebase.com/#bytebase.v1.LoginResponse

Service Account

You should create service account to interact with the Bytebase API.

Visit Bytebase member management page (Click Settings on the navigation bar, and then click Workspace > Members).

Name your service account, and grant the Owner or DBA role to it.

create-service-account

You can only copy the key right after creating the service account. The key will disappear if you refresh the page.

Login to fetch the token

You need to obtain the exchange token before calling the API.

export bytebase_url=http://bytebase.example.com
export bytebase_account=<<your_service_account>>@service.bytebase.com
export bytebase_password=<<your_service_key>>

bytebase_token=$(curl -v ${bytebase_url}/v1/auth/login \
    --data-raw '{"email":"'${bytebase_account}'","password":"'${bytebase_password}'","web":true}' \
    --compressed 2>&1 | grep token | grep -o 'access-token=[^;]*;' | grep -o '[^;]*' | sed 's/access-token=//g; s/;//g')

Test API

# List projects
curl --request GET ${bytebase_url}/v1/projects \
  --header 'Authorization: Bearer '${bytebase_token}
Edit this page on GitHub

Subscribe to Newsletter

By subscribing, you agree with Bytebase's Terms of Service and Privacy Policy.