Fork me on GitHub


Access REST APIs With Teleport Application Access

  • Available for:
  • OpenSource
  • Team
  • Cloud
  • Enterprise

The Teleport Application Service can be used to access applications' (REST or Teleport's own gRPC) APIs with tools like curl or Postman.

Non-HTTP API Support

Use TCP application access for non-HTTP APIs (like gRPC).


  • A running Teleport cluster. For details on how to set this up, see the Getting Started guide.

  • The tctl admin tool and tsh client tool version >= 14.0.1.

    See Installation for details.

  • A Teleport Team account. If you don't have an account, sign up to begin your free trial.

  • The Enterprise tctl admin tool and tsh client tool, version >= 13.3.9.

    You can download these tools from the Cloud Downloads page.

  • A running Teleport Enterprise cluster. For details on how to set this up, see the Enterprise Getting Started guide.

  • The Enterprise tctl admin tool and tsh client tool version >= 14.0.1.

    You can download these tools by visiting your Teleport account workspace.

Cloud is not available for Teleport v.
Please use the latest version of Teleport Enterprise documentation.

To check version information, run the tctl version and tsh version commands. For example:

tctl version

Teleport Enterprise v13.3.9 git:api/14.0.0-gd1e081e go1.21

tsh version

Teleport v13.3.9 go1.21

Proxy version: 13.3.9Proxy:
  • To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands on your administrative workstation using your current credentials. For example:

    tsh login --user=[email protected]
    tctl status


    Version 14.0.1

    CA pin sha256:abdc1245efgh5678abdc1245efgh5678abdc1245efgh5678abdc1245efgh5678

    If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

  • For simplicity's sake, we'll use Grafana running in a Docker container and execute API queries against it. You can launch Grafana too with a single Docker command:

    docker run -d -p 3000:3000 grafana/grafana

    Connect Grafana to your Teleport cluster by adding the following section in the Teleport App Service YAML configuration file:

      enabled: yes
      - name: "grafana"
        description: "Test Grafana server"
        uri: "http://localhost:3000"
          "env": "dev"

Accessing the API

Log into your Teleport cluster and view available applications:

tsh login
tsh apps ls

Application Description Public Address Labels

----------- ------------------- ---------------------------- -------

grafana Test Grafana server env=dev

Retrieve short-lived X.509 certificate for the application:

tsh apps login grafana

Logged into app grafana. Example curl command:

curl \ --cert /Users/alice/.tsh/keys/ \ --key /Users/alice/.tsh/keys/ \

The login message shows an example curl command you can run to call the target application's API through Teleport App Access.

CA and Key Pair Files

Note the paths to your user's certificate/key pair in the command - curl will use a client certificate to authenticate with Teleport.

The Teleport Proxy Service is usually configured with a wildcard certificate issued by a public certificate authority such as Let's Encrypt. If you are running a self-hosted Teleport cluster, and your Teleport Proxy Service has been configured to use a self-signed certificate instead, you will need to include it in your curl command using --cacert <path>.

As Grafana's API requires authentication, let's update the curl command to provide basic auth information using default Grafana username/password and call its /api/users endpoint:

curl --user admin:admin \ --cert /Users/alice/.tsh/keys/ \ --key /Users/alice/.tsh/keys/ \

[{"id":1,"name":"","login":"admin","email":"admin@localhost","avatarUrl":"/avatar/46d229b033af06a191ff2267bca9ae56","isAdmin":true,"isDisabled":false,"lastSeenAt":"2021-03-18T17:25:59Z","lastSeenAtAge":"\u003c 1m","authLabels":[]}]

The app's X.509 certificate will expire on its own after the TTL allowed by your user's role. You can also remove it explicitly:

tsh apps logout

Logged out of app "grafana"

Application information

tsh apps config

shows current app URI and paths to the secrets.

This is useful when configuring CLI tools (such as curl) or GUI tools (such as Postman).

Let's print the app information in a table format:

tsh apps config

Name: grafana


CA: /Users/alice/.tsh/keys/

Cert: /Users/alice/.tsh/keys/

Key: /Users/alice/.tsh/keys/

We can also provide different --format values to print specific parts of the app configuration:

tsh apps config --format=uri

tsh apps config --format=ca


tsh apps config --format=cert


tsh apps config --format=key


This can be useful in automation for simple templating e.g. to construct an appropriate curl command. Using our Grafana /api/users example above:

curl --user admin:admin \ --cert $(tsh apps config --format=cert) \ --key $(tsh apps config --format=key) \ $(tsh apps config --format=uri)/api/users