API Keys¶
Your API key provides authentication to the Equinix Metal™ API and the tools and services that are built on top of it, such as the CLI or Terraform.
There are two different API keys:
- User API keys which are associated with specific user accounts. User API keys have all the same permissions across all the Projects and Organizations that the user has access to.
- Project API keys which are associated with a specific Project. Project API keys can only be used to access resources within that project and they have their own set subset of permissions.
User API Keys¶
You are only able to manage the User API Keys associated with your own user account. You are not able to manage any other user's API keys.
Creating Your API Keys¶
You can create an API key for your user in the Equinix Metal console or through the API itself.
To create an API key in the console, navigate to the API Keys tab of your user account, and click Add New Key. Add a description for the key, and chose whether it has Read/Write or Read-only permissions.
To create an API key associated with your user account, send a POST
request to the /user/api-keys
endpoint. Use the body parameters to add a description or to set the key as read-only.
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/user/api-keys" \
-d '{
"description": "string",
"read_only": false
}'
Managing Your API Keys¶
Your API keys are listed in the API Keys tab of your user account.
To retrieve all the API keys associated with your user account, sent a GET
request to the /user/api-keys
endpoint.
curl -X GET -H 'X-Auth-Token: <API_TOKEN>' \
"https://api.equinix.com/metal/v1/user/{id}/api-keys"
Deleting Your API Keys¶
API keys can be deleted without affecting any of the resources created with them.
Note - API keys that are associated with users are not able to be managed on an Org or Project level. You are not able to manage any other user's API keys. If you need to remove a user's API key access from an Org or Project, you will have to remove their user from the Org or Project.
To delete an API key from the console, navigate to the API Keys tab of your user account, and click Delete next to key you want to delete.
To delete an API key from the API, send a DELETE
request to the /user/{id}/api-keys
endpoint.
curl -X DELETE -H 'X-Auth-Token: <API_TOKEN>' \
"https://api.equinix.com/metal/v1/user/{id}/api-keys"
Project API Keys¶
Creating Project API Keys¶
Project API keys can be obtained by creating them in the Equinix Metal console or the API itself.
You can create a Project API key in the Project Settings, on the API Keys tab. Click Add an API Key. Add a description for the key, and chose whether it has Read/Write or Read-only permissions.
To create a Project API key, send a POST
request to the /projects/{id}/api-keys
endpoint. Use the body parameters to add a description or to set the key as read-only.
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/projects/{id}/api-keys" \
-d '{
"description": "string",
"read_only": false
}'
Managing Project API Keys¶
A Project's API keys are listed in the API Keys tab of the Project Settings.
To retrieve all the API keys associated with a Project, sent a GET
request to the /projects/{id}api-keys
endpoint.
curl -X GET -H 'X-Auth-Token: <API_TOKEN>' \
"https://api.equinix.com/metal/v1/projects/{id}/api-keys"
Deleting Project API Keys¶
Access granted using a Project API key can be revoked by deleting the Project API key. This will not affect any of the resources created with the key.
To delete an API key from the console, navigate to the API Keys tab of the Project Settings, and click Delete next to key you want to delete.
To delete an API key from the API, send a DELETE
request to the api-keys/{id}
endpoint.
curl -X DELETE -H 'X-Auth-Token: <API_TOKEN>' \
"https://api.equinix.com/metal/v1/api-keys/{id}"