1. Docs
  2. API Reference
  3. Authenticate and receive tokens

Authenticate and receive tokens

POST/v1/auth/login

Request body

  • emailstring*

    User email address

  • passwordstring*

    User password

  • include_permissionsboolean

    Include effective permissions in the access token claims (opt-in cache)

Code samples

cURLJavaScriptPythonGo
curl -X POST "https://api.canopy.dev/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "string",
    "password": "string",
    "include_permissions": false
  }'

Responses

200 Tokens returned (or Account selection required)
{
  "requires_account_selection": false,
  "requires_application_selection": false,
  "expires_in": 0,
  "user": {
    "id": "string",
    "email": "string",
    "first_name": "string",
    "last_name": "string"
  },
  "access_token": "string",
  "token_type": "string",
  "default_environment_slug": "string",
  "account": {
    "account_id": "string",
    "account_name": "string",
    "account_slug": "string",
    "applications": [
      {
        "id": "string",
        "name": "string",
        "slug": "string"
      }
    ]
  },
  "applications": [
    {
      "id": "string",
      "name": "string",
      "slug": "string"
    }
  ],
  "accounts": [
    {
      "account_id": "string",
      "account_name": "string",
      "account_slug": "string",
      "applications": [
        {
          "id": "string",
          "name": "string",
          "slug": "string"
        }
      ]
    }
  ]
}

application/json

  • requires_account_selectionboolean*
  • requires_application_selectionboolean*
  • expires_innumber*
  • userAuthUserDto
  • access_tokenstring
  • token_typestring
  • default_environment_slugstring
  • accountAuthAccountDto
  • applicationsAuthApplicationDto[]
  • accountsAuthAccountDto[]

Returned object

On this page

Related endpoints

POSTRegister a new user
POSTLook up invite details by token
POSTAccept an invite
POSTSelect an Application from a pre-auth session (post-login picker)
POSTSwitch the active Application in an authenticated session
POSTRefresh access token
POSTLogout and revoke tokens
GETVerify email address
POSTResend verification email
POSTRequest password reset
POSTReset password with token
POSTChange password (authenticated)
GETGet current user profile
GETGet current user permissions
GETList the Accounts the current user belongs to
GETList active sessions
DELETERevoke all sessions
DELETERevoke a specific session