Authentication

Some endpoints require basic HTTP authentication (opens new window). Set the username to your personal Craft Console (opens new window) account’s username or email, and the password to your API key:

# ...
Authorization: Basic brandonkelly:0hgtqgre7utx7258u3j2vt6pvhevin4buo333whl
# ...

All API access is authorized in the context of an individual account, even when retrieving records owned by organizations. More information on managing organizations (opens new window) is available in the Knowledge Base.

TIP

Some HTTP libraries (like curl (opens new window) and Guzzle (opens new window)) will automatically build the correct headers for you—any endpoints requiring authorization will include a complete request sample.

# Getting an API Key

Generate a new API key from your console.craftcms.com (opens new window) account, by visiting SettingsProfile. They key will only be displayed once, so copy and store it securely—regenerating it will immediately invalidate the previous one.