View as Markdown
API

Application keys with only the permissions they need

An application key now holds the permissions you pick, resource by resource, and can stop working on a date you set.

Until now an application key was either admin, reaching everything an organization admin can do, or ci, uploading CI results and nothing else. A status board that only reads the merge queue, a script that manages quarantines or an agent that must never pause the queue got an admin key anyway. Now a key holds exactly what its tool needs: on each API resource, No access, Read, or Read & write.

  • Pick the permissions resource by resource when you create a key, or give it every resource at Read or Read & write.
  • Change a key’s permissions later without changing its secret: whatever uses it keeps working.
  • Give a key an expiry date: once it passes, Mergify refuses the key and says when it expired.
  • See every key’s permissions and expiry in the list, and each change to a key in the organization’s Activity Log.

The API reference names the permission each operation needs, in x-mergify-permission and under the new ApplicationKey security scheme, and GET /v1/application returns the calling key’s permissions and expires_at, with scope: custom for a key that is neither admin nor ci.

Organization admins create and edit these keys on the Application Keys page, and the CI Admin role still creates keys that report CI results. Existing admin and ci keys reach exactly what they did. There is nothing to turn on, on Mergify’s cloud and on-premise alike: see which permission each tool needs.

Was this page helpful?