Authenticate and receive tokens
/v1/auth/loginRequest body
email *stringUser email address
password *stringUser password
include_permissionsbooleanInclude effective permissions in the access token claims (opt-in cache)
Code samples
curl -X POST "https://api.canopy.dev/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "string",
"password": "string",
"include_permissions": false
}'const response = await fetch("https://api.canopy.dev/v1/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"email": "string",
"password": "string",
"include_permissions": false
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.canopy.dev/v1/auth/login",
headers={
"Content-Type": "application/json"
},
json={
"email": "string",
"password": "string",
"include_permissions": False,
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"email": "string",
"password": "string",
"include_permissions": false,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.canopy.dev/v1/auth/login", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}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_selection *booleanrequires_application_selection *booleanexpires_in *numberuserAuthUserDtoaccess_tokenstringtoken_typestringdefault_environment_slugstringaccountAuthAccountDtoapplicationsAuthApplicationDto[]accountsAuthAccountDto[]