Keygen Policies API

Licensing rules that govern licenses.

OpenAPI Specification

keygen-policies-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Keygen Artifacts Policies API
  description: 'Representative OpenAPI description of the Keygen software licensing, entitlements, and distribution API. Keygen follows the JSON:API specification (https://jsonapi.org): request and response bodies use the media type `application/vnd.api+json` and wrap resources in a top-level `data` object with `type`, `id`, `attributes`, and `relationships`. All endpoints are scoped to an account under `/v1/accounts/{account}`, where `{account}` is the account''s UUID or slug. Authentication is a Bearer token (admin, environment, product, user, or license token) or, for license validation, a license key. This document is a faithful subset intended for discovery; consult keygen.sh/docs/api for the full, authoritative reference.'
  termsOfService: https://keygen.sh/terms/
  contact:
    name: Keygen Support
    url: https://keygen.sh/contact/
    email: support@keygen.sh
  license:
    name: Documentation - CC BY 4.0
    url: https://keygen.sh/docs/api/
  version: '1.0'
servers:
- url: https://api.keygen.sh/v1/accounts/{account}
  description: Keygen Cloud (and default self-hosted CE/EE base path)
  variables:
    account:
      default: your-account-id
      description: Account UUID or slug.
security:
- bearerAuth: []
- licenseKeyAuth: []
tags:
- name: Policies
  description: Licensing rules that govern licenses.
paths:
  /policies:
    post:
      operationId: createPolicy
      tags:
      - Policies
      summary: Create a policy
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/PolicyDocument'
      responses:
        '201':
          description: Policy created.
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/PolicyDocument'
    get:
      operationId: listPolicies
      tags:
      - Policies
      summary: List all policies
      responses:
        '200':
          description: A list of policies.
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/PolicyCollectionDocument'
  /policies/{id}:
    parameters:
    - $ref: '#/components/parameters/Id'
    get:
      operationId: retrievePolicy
      tags:
      - Policies
      summary: Retrieve a policy
      responses:
        '200':
          description: A policy.
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/PolicyDocument'
    patch:
      operationId: updatePolicy
      tags:
      - Policies
      summary: Update a policy
      responses:
        '200':
          description: Policy updated.
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/PolicyDocument'
    delete:
      operationId: deletePolicy
      tags:
      - Policies
      summary: Delete a policy
      responses:
        '204':
          description: Policy deleted.
components:
  parameters:
    Id:
      name: id
      in: path
      required: true
      description: The identifier (UUID) of the resource.
      schema:
        type: string
        format: uuid
  schemas:
    PolicyResource:
      type: object
      properties:
        type:
          type: string
          example: policies
        id:
          type: string
        attributes:
          type: object
          properties:
            name:
              type: string
            duration:
              type: integer
              nullable: true
            maxMachines:
              type: integer
              nullable: true
            maxCores:
              type: integer
              nullable: true
            maxUses:
              type: integer
              nullable: true
            floating:
              type: boolean
            strict:
              type: boolean
            encrypted:
              type: boolean
            protected:
              type: boolean
            requireCheckIn:
              type: boolean
            checkInInterval:
              type: string
              enum:
              - day
              - week
              - month
              - year
              nullable: true
            expirationStrategy:
              type: string
              enum:
              - RESTRICT_ACCESS
              - REVOKE_ACCESS
              - MAINTAIN_ACCESS
              - ALLOW_ACCESS
            authenticationStrategy:
              type: string
              enum:
              - TOKEN
              - LICENSE
              - MIXED
              - NONE
            overageStrategy:
              type: string
              enum:
              - NO_OVERAGE
              - ALWAYS_ALLOW_OVERAGE
              - ALLOW_1_25X_OVERAGE
              - ALLOW_1_5X_OVERAGE
              - ALLOW_2X_OVERAGE
            scheme:
              type: string
              nullable: true
            metadata:
              type: object
              additionalProperties: true
        relationships:
          type: object
          properties:
            account:
              $ref: '#/components/schemas/Relationship'
            product:
              $ref: '#/components/schemas/Relationship'
    PolicyDocument:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/PolicyResource'
    Relationship:
      type: object
      properties:
        data:
          oneOf:
          - $ref: '#/components/schemas/ResourceIdentifier'
          - type: array
            items:
              $ref: '#/components/schemas/ResourceIdentifier'
          - type: 'null'
        links:
          type: object
          properties:
            related:
              type: string
    PolicyCollectionDocument:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PolicyResource'
        links:
          $ref: '#/components/schemas/PageLinks'
    ResourceIdentifier:
      type: object
      properties:
        type:
          type: string
        id:
          type: string
      required:
      - type
      - id
    PageLinks:
      type: object
      properties:
        self:
          type: string
        first:
          type: string
        prev:
          type: string
        next:
          type: string
        last:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: token
      description: 'Admin, environment, product, user, or license bearer token in the `Authorization: Bearer <token>` header.'
    licenseKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: license-key
      description: 'A license key passed as `Authorization: License <key>` for license validation and self-service actions.'
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic (email:password) used only to generate a user token.