Packet Host Authentication API

Nearly all of the endpoints in the API require authentication. Authentication is performed by providing an authentication token (interchangeably referred to as an API key) in the `X-Auth-Token` HTTP request header. User API keys can be obtained by creating them in the Equinix Metal Portal or by using the [Create a User API Key](#operation/createAPIKey) endpoint. Project API keys can also be obtained by creating them in the Equinix Metal Portal or by using the [Create a Project API Key](#operation/createProjectAPIKey) endpoint. Project API keys are scoped to a single project and can only be used to access resources within that project. For example, to use an authenticated API token, you would make a request like the following: ```bash curl -H 'X-Auth-Token: my_authentication_token' \ https://api.equinix.com/metal/v1/user/api-keys ``` Applications can take advantage of the Equinix Metal API and API keys to perform any of the actions that can be performed in the Equinix Metal Portal. For example, you can use the API to create and manage devices, projects, and other resources. API keys can be deleted without affecting any of the resources created with them. Access to applications using the API can be revoked by deleting the API key used to authenticate the application.

OpenAPI Specification

packet-host-authentication-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  contact:
    email: support@equinixmetal.com
    name: Equinix Metal API Team
  description: "# Introduction\nEquinix Metal provides a RESTful HTTP API which can be reached at <https://api.equinix.com/metal/v1>. This document describes the API and how to use it.\n\nThe API allows you to programmatically interact with all\nof your Equinix Metal resources, including devices, networks, addresses, organizations,\nprojects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API.\n\nThe API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at <https://metal.equinix.com/developers/api>.\n\n# Common Parameters\n\nThe Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them.\n\n## Pagination\n\nPagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters.\n\nThe `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type.\n\n## Sorting\n\nWhere offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending).\n\n## Filtering\n\nFiltering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter.\n\nFor example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request:\n\n```sh\ncurl -H 'X-Auth-Token: my_authentication_token' \\\n  https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4\n```\n\nOnly IP addresses with the `type` field set to `public_ipv4` will be returned.\n\n## Searching\n\nSearching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints.\n\nTo search resources you can use the `search` query parameter.\n\n## Include and Exclude\n\nFor resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource.\n\n```json\n{\n  ...\n  \"project\": {\n    \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\"\n  }\n}\n```\n\nIf you're going need the project details, you can avoid a second API request.  Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter.\n\nFor example:\n\n```sh\ncurl -H 'X-Auth-Token: my_authentication_token' \\\n  https://api.equinix.com/metal/v1/user?include=projects\n```\n\nThe `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented.\n\nTo have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`).\n\n```sh\ncurl -H 'X-Auth-Token: my_authentication_token' \\\n  https://api.equinix.com/metal/v1/user?include=emails,projects,memberships\n```\n\nYou may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`):\n\n```sh\ncurl -H 'X-Auth-Token: my_authentication_token' \\\n  https://api.equinix.com/metal/v1/user?include=memberships.projects\n```\n\nTo exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field.\n"
  license:
    name: Equinix Metal
    url: https://metal.equinix.com/legal/
  termsOfService: https://metal.equinix.com/legal/
  title: Metal Authentication API
  version: 1.0.0
servers:
- url: https://api.equinix.com/metal/v1
security:
- x_auth_token: []
tags:
- description: "Nearly all of the endpoints in the API require authentication. Authentication is performed by providing an authentication token (interchangeably referred to as an API key) in the `X-Auth-Token` HTTP request header.\n\n<!-- ReDoc-Inject: <security-definitions> -->\n\nUser API keys can be obtained by creating them in the Equinix Metal Portal or by using the [Create a User API Key](#operation/createAPIKey) endpoint.\n\nProject API keys can also be obtained by creating them in the Equinix Metal Portal or by using the [Create a Project API Key](#operation/createProjectAPIKey) endpoint. Project API keys are scoped to a single project and can only be used to access resources within that project.\n\nFor example, to use an authenticated API token, you would make a request like the following:\n\n```bash\ncurl -H 'X-Auth-Token: my_authentication_token' \\\n  https://api.equinix.com/metal/v1/user/api-keys\n```\n\nApplications can take advantage of the Equinix Metal API and API keys to perform any of the actions that can be performed in the Equinix Metal Portal. For example, you can use the API to create and manage devices, projects, and other resources.\n\nAPI keys can be deleted without affecting any of the resources created with them. Access to applications using the API can be revoked by deleting the API key used to authenticate the application.\n"
  externalDocs:
    url: https://metal.equinix.com/developers/docs/accounts/users/#api-keys
  name: Authentication
paths:
  /api-keys/{id}:
    delete:
      description: Deletes the API key.
      operationId: deleteAPIKey
      parameters:
      - description: API Key UUID
        in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '204':
          description: no content
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: not found
      summary: Delete the API key
      tags:
      - Authentication
  /projects/{id}/api-keys:
    get:
      description: Returns all API keys for a specific project.
      operationId: findProjectAPIKeys
      parameters:
      - description: Project UUID
        in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      - description: 'Nested attributes to include. Included objects will return their full

          attributes. Attribute names can be dotted (up to 3 levels) to included deeply

          nested objects.'
        explode: false
        in: query
        name: include
        schema:
          items:
            type: string
          type: array
        style: form
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthTokenList'
          description: ok
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: not found
      summary: Retrieve all API keys for the project.
      tags:
      - Authentication
    post:
      description: Creates an API key for a project.
      operationId: createProjectAPIKey
      parameters:
      - description: Project UUID
        in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      - description: 'Nested attributes to include. Included objects will return their full

          attributes. Attribute names can be dotted (up to 3 levels) to included deeply

          nested objects.'
        explode: false
        in: query
        name: include
        schema:
          items:
            type: string
          type: array
        style: form
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthTokenInput'
        description: API Key to create
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthToken'
          description: created
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unprocessable entity
      summary: Create an API key for a project.
      tags:
      - Authentication
  /user/api-keys:
    get:
      description: Returns all API keys for the current user.
      operationId: findAPIKeys
      parameters:
      - description: Search by description
        in: query
        name: search
        schema:
          type: string
      - description: 'Nested attributes to include. Included objects will return their full

          attributes. Attribute names can be dotted (up to 3 levels) to included deeply

          nested objects.'
        explode: false
        in: query
        name: include
        schema:
          items:
            type: string
          type: array
        style: form
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthTokenList'
          description: ok
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: not found
      summary: Retrieve all user API keys
      tags:
      - Authentication
    post:
      description: Creates a API key for the current user.
      operationId: createAPIKey
      parameters:
      - description: 'Nested attributes to include. Included objects will return their full

          attributes. Attribute names can be dotted (up to 3 levels) to included deeply

          nested objects.'
        explode: false
        in: query
        name: include
        schema:
          items:
            type: string
          type: array
        style: form
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthTokenInput'
        description: API key to create
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthToken'
          description: created
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unprocessable entity
      summary: Create an API key
      tags:
      - Authentication
  /user/api-keys/{id}:
    delete:
      description: Deletes the current user API key.
      operationId: deleteUserAPIKey
      parameters:
      - description: API Key UUID
        in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '204':
          description: no content
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: not found
      summary: Delete the API key
      tags:
      - Authentication
components:
  schemas:
    User:
      example:
        avatar_thumb_url: avatar_thumb_url
        last_login_at: 2000-01-23 04:56:07+00:00
        max_projects: 2
        timezone: timezone
        default_project_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        created_at: 2000-01-23 04:56:07+00:00
        last_name: last_name
        short_id: short_id
        fraud_score: fraud_score
        emails:
        - href: href
        - href: href
        default_organization_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        full_name: full_name
        avatar_url: avatar_url
        updated_at: 2000-01-23 04:56:07+00:00
        phone_number: phone_number
        customdata: '{}'
        href: href
        id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        first_name: first_name
        max_organizations: 3
        two_factor_auth: two_factor_auth
        email: email
      properties:
        avatar_thumb_url:
          type: string
        avatar_url:
          type: string
        created_at:
          format: date-time
          type: string
        customdata:
          type: object
        default_organization_id:
          format: uuid
          type: string
        default_project_id:
          format: uuid
          type: string
        email:
          type: string
        emails:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        first_name:
          type: string
        fraud_score:
          type: string
        full_name:
          type: string
        href:
          type: string
        id:
          format: uuid
          type: string
        last_login_at:
          format: date-time
          type: string
        last_name:
          type: string
        max_organizations:
          type: integer
        max_projects:
          type: integer
        phone_number:
          type: string
        short_id:
          type: string
        timezone:
          type: string
        two_factor_auth:
          type: string
        updated_at:
          format: date-time
          type: string
      type: object
    Href:
      example:
        href: href
      properties:
        href:
          type: string
      required:
      - href
      type: object
    Project_type:
      description: The type of the project. Projects of type `vmce` are part of an in development feature and not available to all customers.
      enum:
      - default
      - vmce
      type: string
    Coordinates:
      example:
        latitude: latitude
        longitude: longitude
      properties:
        latitude:
          type: string
        longitude:
          type: string
      type: object
    AuthToken_project:
      allOf:
      - $ref: '#/components/schemas/Project'
      - description: Available only for project tokens
        type: object
    Project:
      example:
        devices:
        - href: href
        - href: href
        volumes:
        - href: href
        - href: href
        created_at: 2000-01-23 04:56:07+00:00
        type: null
        memberships:
        - href: href
        - href: href
        bgp_config:
          href: href
        tags:
        - tags
        - tags
        max_devices: '{}'
        ssh_keys:
        - href: href
        - href: href
        updated_at: 2000-01-23 04:56:07+00:00
        invitations:
        - href: href
        - href: href
        members:
        - href: href
        - href: href
        organization:
          website: website
          address:
            country: country
            address: address
            address2: address2
            city: city
            coordinates:
              latitude: latitude
              longitude: longitude
            state: state
            zip_code: zip_code
          projects:
          - href: href
          - href: href
          credit_amount: 1.4658129
          created_at: 2000-01-23 04:56:07+00:00
          description: description
          billing_address:
            country: country
            address: address
            address2: address2
            city: city
            coordinates:
              latitude: latitude
              longitude: longitude
            state: state
            zip_code: zip_code
          memberships:
          - href: href
          - href: href
          enforce_2fa_at: 2000-01-23 04:56:07+00:00
          twitter: twitter
          updated_at: 2000-01-23 04:56:07+00:00
          terms: 5
          members:
          - href: href
          - href: href
          name: name
          logo: logo
          customdata: '{}'
          id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        name: name
        network_status: '{}'
        customdata: '{}'
        href: href
        id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        payment_method:
          href: href
      properties:
        bgp_config:
          $ref: '#/components/schemas/Href'
        created_at:
          format: date-time
          type: string
        customdata:
          type: object
        devices:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        href:
          type: string
        id:
          format: uuid
          type: string
        invitations:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        max_devices:
          type: object
        members:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        memberships:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        name:
          description: The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis.
          maxLength: 80
          minLength: 1
          type: string
        network_status:
          type: object
        organization:
          $ref: '#/components/schemas/Organization'
        payment_method:
          $ref: '#/components/schemas/Href'
        ssh_keys:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        updated_at:
          format: date-time
          type: string
        volumes:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        type:
          $ref: '#/components/schemas/Project_type'
        tags:
          items:
            type: string
          type: array
      type: object
    Organization:
      example:
        website: website
        address:
          country: country
          address: address
          address2: address2
          city: city
          coordinates:
            latitude: latitude
            longitude: longitude
          state: state
          zip_code: zip_code
        projects:
        - href: href
        - href: href
        credit_amount: 1.4658129
        created_at: 2000-01-23 04:56:07+00:00
        description: description
        billing_address:
          country: country
          address: address
          address2: address2
          city: city
          coordinates:
            latitude: latitude
            longitude: longitude
          state: state
          zip_code: zip_code
        memberships:
        - href: href
        - href: href
        enforce_2fa_at: 2000-01-23 04:56:07+00:00
        twitter: twitter
        updated_at: 2000-01-23 04:56:07+00:00
        terms: 5
        members:
        - href: href
        - href: href
        name: name
        logo: logo
        customdata: '{}'
        id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
      properties:
        address:
          $ref: '#/components/schemas/Address'
        billing_address:
          $ref: '#/components/schemas/Address'
        created_at:
          format: date-time
          type: string
        credit_amount:
          format: float
          type: number
        customdata:
          type: object
        description:
          type: string
        enforce_2fa_at:
          description: Force to all members to have enabled the two factor authentication after that date, unless the value is null
          format: date-time
          type: string
        id:
          format: uuid
          type: string
        logo:
          type: string
        members:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        memberships:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        name:
          type: string
        projects:
          items:
            $ref: '#/components/schemas/Href'
          type: array
        terms:
          type: integer
        twitter:
          type: string
        updated_at:
          format: date-time
          type: string
        website:
          type: string
      type: object
    AuthToken:
      example:
        updated_at: 2000-01-23 04:56:07+00:00
        read_only: true
        created_at: 2000-01-23 04:56:07+00:00
        description: description
        project: null
        id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        user: null
        token: token
      properties:
        created_at:
          format: date-time
          type: string
        description:
          description: Available only for API keys
          type: string
        id:
          format: uuid
          type: string
        project:
          $ref: '#/components/schemas/AuthToken_project'
        read_only:
          type: boolean
        token:
          type: string
        updated_at:
          format: date-time
          type: string
        user:
          $ref: '#/components/schemas/AuthToken_user'
      type: object
    AuthTokenInput:
      example:
        read_only: true
        description: description
      properties:
        description:
          type: string
        read_only:
          type: boolean
      type: object
    Address:
      example:
        country: country
        address: address
        address2: address2
        city: city
        coordinates:
          latitude: latitude
          longitude: longitude
        state: state
        zip_code: zip_code
      properties:
        address:
          type: string
        address2:
          type: string
        city:
          type: string
        coordinates:
          $ref: '#/components/schemas/Coordinates'
        country:
          type: string
        state:
          type: string
        zip_code:
          type: string
      required:
      - address
      - country
      - zip_code
      type: object
    Error:
      description: Error responses are included with 4xx and 5xx HTTP responses from the API service. Either "error" or "errors" will be set.
      properties:
        error:
          description: A description of the error that caused the request to fail.
          type: string
        errors:
          description: A list of errors that contributed to the request failing.
          items:
            description: An error message that contributed to the request failing.
            type: string
          type: array
      type: object
    AuthTokenList:
      example:
        api_keys:
        - updated_at: 2000-01-23 04:56:07+00:00
          read_only: true
          created_at: 2000-01-23 04:56:07+00:00
          description: description
          project: null
          id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          user: null
          token: token
        - updated_at: 2000-01-23 04:56:07+00:00
          read_only: true
          created_at: 2000-01-23 04:56:07+00:00
          description: description
          project: null
          id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
          user: null
          token: token
      properties:
        api_keys:
          items:
            $ref: '#/components/schemas/AuthToken'
          type: array
      type: object
    AuthToken_user:
      allOf:
      - $ref: '#/components/schemas/User'
      - description: Available only for user tokens
        type: object
  securitySchemes:
    x_auth_token:
      description: 'HTTP header containing the User or Project API key that will be used to authenticate the request.

        '
      in: header
      name: X-Auth-Token
      type: apiKey
      x-displayName: X-Auth-Token
x-tagGroups:
- name: Accounts and Organization
  tags:
  - Authentication
  - Emails
  - Invitations
  - Memberships
  - Organizations
  - OTPs
  - PasswordResetTokens
  - PaymentMethods
  - Projects
  - SSHKeys
  - SupportRequest
  - TransferRequests
  - TwoFactorAuth
  - Users
  - UserVerificationTokens
- name: Services and Billing
  tags:
  - Events
  - Facilities
  - Incidents
  - Invoices
  - Licenses
  - Metros
  - Plans
  - Usages
- name: Servers
  tags:
  - Devices
  - Batches
  - Capacity
  - HardwareReservations
  - OperatingSystems
  - Ports
  - SelfServiceReservations
  - SpotMarket
  - Userdata
  - Volumes
- name: Networking
  tags:
  - BGP
  - Interconnections
  - IPAddresses
  - MetalGateways
  - VLANs
  - VRFs