Passbolt GPG keys API

In order to encrypt information, the server and the clients needs the user's public keys. These OpenPGP endpoints let you query the saved public key data.

OpenAPI Specification

passbolt-gpg-keys-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: contact@passbolt.com
  description: This is a low-level overview of the API and its endpoints, if you need higher-level guides for interacting with the endpoints, use the Developer guide.
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  termsOfService: https://www.passbolt.com/terms
  title: Passbolt Authentication (GPGAuth) Authentication (GPGAuth) GPG keys API
  version: 5.0.0
servers:
- url: https://passbolt.local
  description: API Passbolt
tags:
- name: GPG keys
  description: 'In order to encrypt information, the server and the clients needs the user''s public keys. These OpenPGP endpoints let you query the saved public key data.

    '
paths:
  /gpgkeys.json:
    get:
      summary: Get multiple GPG keys.
      operationId: indexGpgkeys
      security:
      - bearerHttpAuthentication: []
      x-codeSamples:
      - lang: cURL
        source: "curl --request GET \\\n  --url {{API_BASE_URL}}/gpgkeys.json \\\n  --header 'Authorization: Bearer {{JWT_TOKEN}}'\n"
      - lang: JavaScript
        source: "const url = '{{API_BASE_URL}}/gpgkeys.json';\nconst options = {method: 'GET', headers: {Authorization: 'Bearer {{JWT_TOKEN}}'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n"
      - lang: PHP
        source: "<?php\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"{{API_BASE_URL}}/gpgkeys.json\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Bearer {{JWT_TOKEN}}\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n"
      tags:
      - GPG keys
      parameters:
      - $ref: '#/components/parameters/filterModifiedAfter'
      - $ref: '#/components/parameters/filterIsDeleted'
      responses:
        '200':
          $ref: '#/components/responses/gpgkeys_index'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/authenticationRequired'
  /gpgkeys/{gpgkeyId}.json:
    get:
      summary: Get a GPG key.
      operationId: viewGpgkey
      security:
      - bearerHttpAuthentication: []
      x-codeSamples:
      - lang: cURL
        source: "curl --request GET \\\n  --url {{API_BASE_URL}}/gpgkeys/ed4d9ea6-f354-4a74-ad09-4e1dd69041ec.json \\\n  --header 'Authorization: Bearer {{JWT_TOKEN}}'\n"
      - lang: JavaScript
        source: "const url = '{{API_BASE_URL}}/gpgkeys/ed4d9ea6-f354-4a74-ad09-4e1dd69041ec.json';\nconst options = {method: 'GET', headers: {Authorization: 'Bearer {{JWT_TOKEN}}'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n"
      - lang: PHP
        source: "<?php\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"{{API_BASE_URL}}/gpgkeys/ed4d9ea6-f354-4a74-ad09-4e1dd69041ec.json\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Bearer {{JWT_TOKEN}}\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n"
      parameters:
      - $ref: '#/components/parameters/gpgkeyId'
      tags:
      - GPG keys
      responses:
        '200':
          $ref: '#/components/responses/gpgkeys_view'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/authenticationRequired'
        '404':
          $ref: '#/components/responses/notFound'
components:
  responses:
    badRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            required:
            - header
            - body
            properties:
              header:
                $ref: '#/components/schemas/header'
              body:
                type: string
          examples:
            example:
              value:
                header:
                  id: 7ff2828c-1092-4897-8e0a-1dc64ada889f
                  status: error
                  servertime: 1721207029
                  action: 4d0c0996-ce30-4bce-9918-9062ab35c542
                  message: <ERROR MESSAGE>
                  url: <API ENDPOINT URL>
                  code: 400
                body: ''
    notFound:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            required:
            - header
            - body
            properties:
              header:
                $ref: '#/components/schemas/header'
              body:
                type: string
          examples:
            example:
              value:
                header:
                  id: 7ff2828c-1092-4897-8e0a-1dc64ada889f
                  status: error
                  servertime: 1721207029
                  action: 4d0c0996-ce30-4bce-9918-9062ab35c542
                  message: The <MODEL> does not exist.
                  url: <API ENDPOINT URL>
                  code: 404
                body: ''
    gpgkeys_view:
      description: Operation is successful
      content:
        application/json:
          schema:
            type: object
            required:
            - header
            - body
            properties:
              header:
                $ref: '#/components/schemas/header'
              body:
                $ref: '#/components/schemas/gpgkey'
          examples:
            base:
              value:
                header:
                  id: 7ff2828c-1092-4897-8e0a-1dc64ada889f
                  status: success
                  servertime: 1721207029
                  action: 4d0c0996-ce30-4bce-9918-9062ab35c542
                  message: The operation was successful.
                  url: /gpgkeys/ed4d9ea6-f354-4a74-ad09-4e1dd69041ec.json
                  code: 200
                body:
                  id: ed4d9ea6-f354-4a74-ad09-4e1dd69041ec
                  user_id: 8bb80df5-700c-48ce-b568-85a60fc3c8f2
                  armored_key: '-----BEGIN PGP PUBLIC KEY BLOCK-----'
                  bits: 3072
                  uid: Ada Lovelace <ada@passbolt.com>
                  key_id: D277E7A2E45418A0
                  fingerprint: 850C6BDE59E9F126BFB4683BD277E7A2E45418A0
                  type: RSA
                  expires: null
                  key_created: '2024-07-03T12:53:13+00:00'
                  deleted: false
                  created: '2024-07-03T12:53:52+00:00'
                  modified: '2024-07-03T12:53:52+00:00'
    authenticationRequired:
      description: Authentication required.
      content:
        application/json:
          schema:
            type: object
            required:
            - header
            - body
            properties:
              header:
                $ref: '#/components/schemas/header'
              body:
                type: string
          examples:
            base:
              value:
                header:
                  id: f7be85c0-afb1-4d8e-a9e1-e05abb0bb71a
                  status: error
                  servertime: 1721727753
                  action: e2aa01a9-84ec-55f8-aaed-24ee23259339
                  message: Authentication is required to continue.
                  url: <API ENDPOINT URL>
                  code: 401
                body: ''
    gpgkeys_index:
      description: Operation is successful
      content:
        application/json:
          schema:
            type: object
            required:
            - header
            - body
            properties:
              header:
                $ref: '#/components/schemas/headerWithPagination'
              body:
                type: array
                items:
                  $ref: '#/components/schemas/gpgkey'
          examples:
            base:
              value:
                header:
                  id: 7ff2828c-1092-4897-8e0a-1dc64ada889f
                  status: success
                  servertime: 1721207029
                  action: 4d0c0996-ce30-4bce-9918-9062ab35c542
                  message: The operation was successful.
                  url: /gpgkeys.json
                  code: 200
                  pagination:
                    count: 1
                    page: 1
                    limit: null
                body:
                - id: ed4d9ea6-f354-4a74-ad09-4e1dd69041ec
                  user_id: 8bb80df5-700c-48ce-b568-85a60fc3c8f2
                  armored_key: '-----BEGIN PGP PUBLIC KEY BLOCK-----'
                  bits: 3072
                  uid: Ada Lovelace <ada@passbolt.com>
                  key_id: D277E7A2E45418A0
                  fingerprint: 850C6BDE59E9F126BFB4683BD277E7A2E45418A0
                  type: RSA
                  expires: null
                  key_created: '2024-07-03T12:53:13+00:00'
                  deleted: false
                  created: '2024-07-03T12:53:52+00:00'
                  modified: '2024-07-03T12:53:52+00:00'
  parameters:
    gpgkeyId:
      name: gpgkeyId
      description: ID for the GPG key being manipulated.
      in: path
      required: true
      schema:
        type: string
        format: uuid
    filterIsDeleted:
      name: filter[is-deleted]
      description: Only return deleted elements.
      in: query
      required: false
      schema:
        type: integer
        enum:
        - 1
        - 0
    filterModifiedAfter:
      name: filter[modified-after]
      description: Only return elements modified after a timestamp.
      in: query
      required: false
      schema:
        type: string
  schemas:
    header:
      type: object
      required:
      - id
      - status
      - servertime
      - action
      - message
      - url
      - code
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
          - success
          - error
        servertime:
          type: integer
          example: 1720702619
        action:
          type: string
          format: uuid
        message:
          type: string
          example: The operation was successful.
        url:
          type: string
          format: uri
          example: /auth/verify.json
        code:
          type: integer
          example: 200
    gpgkey:
      type: object
      required:
      - id
      - user_id
      - armored_key
      - bits
      - uid
      - key_id
      - fingerprint
      - type
      - expires
      - key_created
      - deleted
      - created
      - modified
      properties:
        id:
          type: string
          format: uuid
        user_id:
          type: string
          format: uuid
        armored_key:
          type: string
        bits:
          type: integer
        uid:
          type: string
        key_id:
          type: string
        fingerprint:
          type: string
        type:
          type: string
          enum:
          - RSA
          - ECC
        expires:
          type: string
          format: date-time
          x-nullable: true
        deleted:
          type: boolean
        created:
          type: string
          format: date-time
        modified:
          type: string
          format: date-time
    headerWithPagination:
      type: object
      required:
      - id
      - status
      - servertime
      - action
      - message
      - url
      - code
      - pagination
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
          - success
          - error
        servertime:
          type: integer
          example: 1720702619
        action:
          type: string
          format: uuid
        message:
          type: string
          example: The operation was successful.
        url:
          type: string
          format: uri
          example: /auth/verify.json
        code:
          type: integer
          example: 200
        pagination:
          type: object
          required:
          - count
          - page
          - limit
          properties:
            count:
              type: integer
            page:
              type: integer
            limit:
              type: integer
              x-nullable: true
  securitySchemes:
    bearerHttpAuthentication:
      description: Bearer token using a JWT
      type: http
      scheme: Bearer
      bearerFormat: JWT
    gpgCookieAuthentication:
      description: Session-based authentication. Note that a CSRF token needs to be provided through a header named `X-CSRF-Token`.
      type: apiKey
      in: cookie
      name: passbolt_session