Skip to content

Access the API

The API lets a script send requests to AntFlow instead of using the web interface. This guide sets the server address and your access token, then checks that you can connect. An access token is a secret value that authorizes requests.

Run these commands in a Bash terminal. They do not start workflows or change the server. You will need the curl command-line tool to send requests.

1. Choose an instance

Obtain the API base URL from your administrator. It can differ from the UI URL and must include the full path they provide, such as /api. Enter it once:

read -r -p "AntFlow API base URL: " API_URL
API_URL="${API_URL%/}"

Alternatively, choose one of these environments instead of the prompt:

Environment Setup
Hosted demo API_URL="https://ospd.csgroup.space/api"
Local Helm installation with the API port-forward running API_URL="http://localhost:8000"

The demo is a shared environment, not a guarantee of anonymous access or available computing resources. Your account, projects, and launchers determine what you can do. For your own deployment, follow Installation with Helm.

Keep using the same terminal for the examples so API_URL remains available. If you switch instances, replace both the URL and its credential.

2. Check connectivity

curl --fail --silent --show-error "$API_URL/health/"

A successful HTTP response confirms that the server is reachable; it does not establish access to projects or jobs. If the request fails, check the URL, network connectivity, and any required port-forward. Do not disable TLS certificate verification to work around a configuration error.

Open the API base URL followed by /docs in your browser for the deployed server's interactive reference. For the demo, this is https://ospd.csgroup.space/api/docs.

3. Load an API credential

Obtain the credential for your instance's authentication provider. Signing in to the browser does not automatically authenticate curl.

Use your approved credential-loading procedure. For an interactive Bash session, a hidden prompt avoids recording the value in shell history:

read -r -s -p "AntFlow API token: " TOKEN
printf '\n'

Keep TOKEN in this shell; do not print it or enable set -x. A hidden prompt does not make every later use invisible: command arguments may be observable by other processes with sufficient permissions. Follow your organization's requirements for automation and credential storage.

4. Check authentication

curl --fail --silent --show-error \
  --header "Authorization: Bearer $TOKEN" \
  "$API_URL/auth/info"

Inspect the response for your authenticated identity and repository-token status. Fields and values depend on the deployed version and provider. If the request fails, use authentication troubleshooting.

What's next

Keep this terminal session open: the execution guide uses the API_URL and TOKEN variables configured above.

Workflow runs consume resources

Running a workflow uses compute and storage resources, including on the demo instance.

Finish the session

After completing all API requests, including any follow-up guide, remove the credential from the current shell:

unset TOKEN

Renew expired credentials through your identity provider before continuing; changing API_URL does not renew a token.