Fork me on GitHub

API Architecture


The Auth API uses mTLS to authenticate a client-server connection. Therefore, the client must provide TLS certificates signed by the Auth server to access the API. These are easy to create and provide using Credential loaders.


The client certificates signed by the Auth server will be associated with a specific user. This user will be used to authorize API requests made by the client.

It is recommended to make a new user and role for each client. This makes it easier to track client actions, as well as carefully control client permissions.

For example, if your client needs to use client.GetRole(), the user must have permission to perform the read action on the role resource. You should create a user and role with the minimum permissions required.


The examples below may include the use of the sudo keyword, token UUIDs, and users with admin privileges to make following each step easier when creating resources from scratch.


  1. We discourage using sudo in production environments unless it's needed.
  2. We encourage creating new, non-root, users or new test instances for experimenting with Teleport.
  3. We encourage adherence to the Principle of Least Privilege (PoLP) and Zero Admin best practices. Don't give users the admin role when giving them the more restrictive access,editor roles will do instead.
  4. Saving tokens into a file rather than sharing tokens directly as strings.

Learn more about Teleport Role-Based Access Control best practices.

# Copy and Paste the below and run on the Teleport Auth server.
cat > api-role.yaml <<EOF
kind: role
  name: api-role
      - resources: ['role']
        verbs: ['read']
      '*': '*'
version: v4
# Create role
tctl create -f api-role.yaml
# Add user and login via web proxy
tctl users add api-user --roles=api-role

See our roles documentation for more details on role based access control.


The Teleport Go client uses Credentials to gather and hold TLS certificates, connect to proxy servers over SSH, and perform some other actions.

Credentials are created by using Credential loaders, which gather certificates and data generated by Teleport CLIs.

Since there are several Credential loaders to choose from with distinct benefits, here's a quick breakdown:

  • Profile Credentials are the easiest to get started with. All you have to do is log in to your device with tsh login. Your Teleport proxy address and credentials will automatically be located and used.
  • IdentityFile Credentials are the most well-rounded in terms of usability, functionality, and customizability. Identity files can be generated through tsh login or tctl auth sign, making them ideal for both long-lived proxy and auth server connections.
  • Key Pair Credentials have a much simpler implementation than the first two Credentials listed and may feel more familiar. These are good for authenticating clients hosted directly on the auth server.
  • TLS Credentials leave everything up to the client user. This is mostly used internally, but some advanced users may find it useful.

Here are some more specific details to differentiate them by:

TypeProfile CredentialsIdentity CredentialsKey Pair CredentialsTLS Credentials
Ease of useEasyEasyMediumHard
Supports long-lived certificatesYes, but must be configured on server sideYesYesYes
Supports SSH connectionsYesYes (6.1+)NoNo
Automatic Proxy Address discoveryYesNoNoNo
CLI usedtshtctl/tshtctl-
Available in6.1+6.0+6.0+6.0+

See the Credentials type on for more information and examples for Credentials and Credential Loaders.

Client connection

The API client makes requests through an open connection to the Teleport Auth server.

If the Auth server is isolated behind a Proxy Server, a reverse tunnel connection can be made using SSH certificates signed by the auth server. You can either provide the server's reverse tunnel address directly or provide the web proxy address and have the client automatically retrieve the reverse tunnel address.

While all Credential loaders support mTLS connections, only some support SSH connections (see the chart above).

Take a look at this client constructor example to see what these connection options look like.

Have a suggestion or can’t find something?