The recommended authentication mechanism for automation scripts is Organization Auth Tokens.
Organization Auth Token
Organization Auth Tokens have the same access level as Project Managers, and this applies to every Project in the Organization.
curl -u ":$ORGANIZATION_AUTH_TOKEN" https://api.memfault.com/api/v0/organizations
Don't forget the colon (
:) in front of the token. It separates the empty
username from the password.
memfault --password "$ORGANIZATION_AUTH_TOKEN" ...
User API Key
Requests authenticated via an User API Key can access the resources of all the organizations a user has access to (except when SSO is required). However, they are not suitable for automation, as they will break when the user is removed from the organization.
Users can create and cycle their User API Key via Project Settings → User API Key. Even though they appear there, they are not tied to a certain project.
curl -u "$USER_EMAIL:$USER_API_KEY" https://api.memfault.com/api/v0/organizations
memfault --email "$USER_EMAIL" --password "$USER_API_KEY" ...
A user can use their actual password instead of an User API Key, but this is not recommended.
Requests authenticated via Project Keys (sometimes also referred to as "Project API Keys") have very limited access to a single project. They are meant to be used by devices that send data to Memfault and in contrast to the other mechanisms listed here not considered secrets. They can also be useful during initial development to send up coredumps from a developers machine.
A Project Key is generated automatically upon project creation. Organization Admins and Project Managers can generate and cycle the API key via an API endpoint. Every project member see the project's Project Key.
curl --header "Memfault-Project-Key: $YOUR_PROJECT_KEY" ...
memfault --project-key "$YOUR_PROJECT_KEY" ...