Project API Keys¶
Project API keys are independent of users and are well-suited for automation tooling and CI/CD. User membership can change over time in a project, and users can leave a project at any time. If a user leaves whose API keys were used in project functions, those keys will lose access to the project resources, resulting in unplanned automation failures. By using project API keys, and rotating those keys at the appropriate time, these scenarios can be avoided.
A Project API key has access to resources within a project, but not resources that can manage or own the organization or users. This means that a project API key can not be used to discover billing details, nor can it be used to invite new members into the project or create new project API keys. If a Project API key is compromised, it can be rotated by a member of the Project, reducing risk.
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}"
Endpoints Reference¶
Project API keys have a limited set of access to endpoints and are scoped to the Project that they are created in. Project API keys can do the following:
General Information¶
/capacity/metros | get, post |
/operating-systems | get |
/plans | get |
/projects/{id}/plans | get |
Project Information¶
/projects | get, post |
/projects/{id} | get, put, delete |
/projects/{id}/batches | get |
/projects/{id}/customdata | get |
/projects/{id}/events | get |
/projects/{id}/licenses | get, post |
/projects/{id}/transfers | post |
/projects/{id}/usages | get |
/projects/{project_id}/invitations | get, post |
/projects/{project_id}/memberships | get |
Devices Information¶
/projects/{id}/devices | get, post |
/projects/{id}/devices/batch | post |
/devices/{id} | get, put, delete |
/devices/{id}/actions | post |
/devices/{id}/bandwidth | get |
/devices/{id}/customdata | get |
/devices/{id}/events | get |
/devices/{id}/metadata | get |
/devices/{id}/traffic | get |
/devices/{id}/usages | get |
/devices/{id}/userdata | get |
API Keys¶
/api-keys/{id} | delete |
/projects/{id}/api-keys | get, post |
SSH Keys¶
/projects/{id}/ssh-keys | get, post |
/devices/{id}/ssh-keys | get |
/ssh-keys | get |
/ssh-keys | post |
/ssh-keys/{id} | get, put, delete |
Hardware Reservations¶
/hardware-reservations/{id} | get |
/hardware-reservations/{id}/activate | post |
/hardware-reservations/{id}/move | post |
/projects/{id}/hardware-reservations | get |
/projects/{project_id}/self-service/reservations | get, post |
/projects/{project_id}/self-service/reservations/{id} | get |
The Spot Market¶
/market/spot/prices | get |
/market/spot/prices/history | get |
/market/spot/prices/metros | get |
/projects/{id}/spot-market-requests | get, post |
IP Addresses¶
/devices/{id}/ips | get, post |
/ips/{id} | get, patch, delete |
/ips/{id}/available | get |
/ips/{id}/customdata | get |
/projects/{id}/ips | get, post |
/projects/{project_id}/ips/{id}/customdata | get |
/devices/{instance_id}/ips/{id}/customdata | get |
BGP¶
/devices/{id}/bgp/neighbors | get |
/projects/{id}/global-bgp-ranges | get |
/projects/{id}/bgp-config | get, post |
/projects/{id}/bgp/sessions | get |
/devices/{id}/bgp/sessions | get, post |
Layer 2 Networking Modes and VLANs¶
/ports/{id} | get |
/ports/{id}/assign | post |
/ports/{id}/bond | post |
/ports/{id}/convert/layer-2 | post |
/ports/{id}/convert/layer-3 | post |
/ports/{id}/disbond | post |
/ports/{id}/unassign | post |
/virtual-networks/{id} | get, delete |
/projects/{id}/virtual-networks | get, post |
/ports/{id}/vlan-assignments | get |
/ports/{id}/vlan-assignments/{assignment_id} | get |
/ports/{id}/vlan-assignments/batches | get, post |
/ports/{id}/vlan-assignments/batches/{batch_id} | get |
/ports/{id}/native-vlan | post, delete |
Metal Gateways¶
/metal-gateways/{id} | get, delete |
/metal-gateways/{id}/ips | get, post |
/projects/{project_id}/metal-gateways | get, post |
Interconnection¶
/connections/{connection_id} | get, put, delete |
/connections/{connection_id}/events | get |
/connections/{connection_id}/ports | get |
/connections/{connection_id}/virtual-circuits | get |
/connections/{connection_id}/ports/{id} | get |
/connections/{connection_id}/ports/{id}/events | get |
/connections/{connection_id}/ports/{port_id}/virtual-circuits | get, ports |
/virtual-circuits/{id}/events | get |
/virtual-circuits/{id} | get, put, delete |
/projects/{project_id}/connections | get, post |
VRFs¶
/projects/{id}/vrfs | get, post |
/vrfs/{id} | get, put, delete |
/vrfs/{id}/ips | get |
/vrfs/{vrf_id}/ips/{id} | get |
/vrfs/{id}/routes | get, post |
/routes/{id} | get, put, delete |
/routes/{id}/events | get |
/metal-gateways/{id}/bgp-dynamic-neighbors | get, post |
/bgp-dynamic-neighbors/{id} | get, delete |