Skip to main content

Overview

Argo CD API supports multiple authentication methods for different use cases. All API requests (except session creation) must include valid authentication credentials.

Authentication Methods

Bearer Token Authentication

The recommended method for API access. Include the token in the Authorization header:

Token Types

User tokens are obtained by logging in through the Session API.
Used primarily by the web UI. The session cookie is automatically set when logging in via the browser.

Session Service API

Create Session (Login)

Establish a new authenticated session.

Request

string
required
Username for authentication
string
required
Password for authentication
string
SSO token (alternative to username/password)

Response

string
JWT token for subsequent API requests
Example Response:

Get User Info

Retrieve information about the currently authenticated user.

Response

boolean
Whether the user is currently logged in
string
Username of the authenticated user
string
Token issuer (e.g., “argocd” or SSO provider)
string[]
List of groups the user belongs to
Example Response:

Delete Session (Logout)

Invalidate the current session.

Project Tokens

Project tokens provide scoped access limited to specific projects.

Create Project Token

Generate a new token for a project role.
string
required
Project name
string
required
Role name within the project
string
Human-readable description of the token
int64
Token lifetime in seconds (0 for no expiration)
string
Custom identifier for the token
Example Request:
Example Response:

Delete Project Token

Revoke a project token.
string
required
Project name
string
required
Role name
int64
required
Token issued-at timestamp
string
Token ID (alternative to iat)

SSO Authentication

For SSO-enabled Argo CD installations:
  1. Redirect to SSO provider
  2. Complete SSO authentication flow
  3. Receive token from callback
  4. Use token for API access

Security Best Practices

  • Never commit tokens to version control
  • Use secret management systems (Vault, Secrets Manager)
  • Rotate tokens regularly
  • Use environment variables or secure files
  • Use project tokens for project-specific automation
  • Limit token permissions to minimum required
  • Create separate tokens for different automation tasks
  • Set expiration times for temporary access
  • Always use HTTPS for API requests
  • Validate TLS certificates
  • Consider network policies and firewalls
  • Use VPN or private networks when possible
  • Monitor token usage and creation
  • Set up alerts for suspicious activity
  • Audit token access regularly
  • Revoke unused tokens

Authentication Errors

Common Error Codes

error
No valid authentication provided or token expiredSolution: Obtain a new token via login
error
Authenticated but insufficient permissionsSolution: Check RBAC policies and token scope

Error Response Example

Token Validation

JWT tokens can be decoded (but not verified without the server secret):
Token Claims:

Next Steps

Application API

Use your token to manage applications

Project API

Create and manage project tokens