Authentication
Some endpoints require basic HTTP authentication (opens new window). Set the username to your Craft Console account’s username or email, and the password to your API key:
# ...
Authorization: Basic pixelandtonic:0hgtqgre7utx7258u3j2vt6pvhevin4buo333whl
# ...
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 Settings → Profile. They key will only be displayed once, so copy and store it securely—regenerating it will immediately invalidate the previous one.