---
openapi: "3.0.0"
info:
  version: "1.0.0"
  title: "Ceptor API Management Partner"
  description: "Ceptor API Management Partner related APIs - allows administration\
    \ of Partners, Partner Applications and Developers."
paths:
  /apimgr/partners:
    get:
      summary: "List all partners"
      description: "List all partners registered in the system"
      tags:
      - "api management"
      - "api partner"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                type: "array"
                items:
                  $ref: "#/components/schemas/APIPartner"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/partners/{developerid}:
    get:
      summary: "List all partners for a developer"
      description: "List all partners registered in the system for a specific developer"
      tags:
      - "api management"
      - "api partner"
      parameters:
      - name: "developerid"
        in: "path"
        description: "API Developer ID"
        required: true
        schema:
          type: "string"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                type: "array"
                items:
                  $ref: "#/components/schemas/APIPartner"
        404:
          description: "Not Found"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/partner:
    post:
      summary: "Create a partner"
      description: "Creates an partner from the given data"
      tags:
      - "api management"
      - "api partner"
      requestBody:
        description: "API Partner to create"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/APIPartner"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/APIPartner"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    put:
      summary: "Update a partner"
      description: "Updates a partner from a specific partner ID"
      tags:
      - "api management"
      requestBody:
        description: "API Partner to update"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/APIPartner"
      responses:
        201:
          description: "Update confirmation"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/partner/{partnerid}:
    get:
      summary: "Get a partner with a specific ID"
      description: "Retrieves a partner from a specific partner ID"
      tags:
      - "api management"
      - "api partner"
      parameters:
      - name: "partnerid"
        in: "path"
        description: "API Partner ID"
        required: true
        schema:
          type: "string"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/APIPartner"
        404:
          description: "Not Found"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    delete:
      summary: "Delete a partner"
      description: "Deletes an API Partner from the API Management system"
      tags:
      - "api management"
      - "api partner"
      parameters:
      - name: "partnerid"
        in: "path"
        description: "API Partner ID"
        required: true
        schema:
          type: "string"
      responses:
        201:
          description: "Delete confirmation"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/developer/email/{email}:
    get:
      summary: "Get an API developer"
      description: "Get an API developer from a specific email"
      tags:
      - "api management"
      - "api developer"
      parameters:
      - name: "email"
        in: "path"
        description: "API Developer email"
        required: true
        schema:
          type: "string"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/APIDeveloper"
        404:
          description: "Not Found"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/developer/{developerid}:
    get:
      summary: "Get an API developer"
      description: "Get an API developer from an ID"
      tags:
      - "api management"
      - "api developer"
      parameters:
      - name: "developerid"
        in: "path"
        description: "API Developer Id"
        required: true
        schema:
          type: "string"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/APIDeveloper"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/application/{applicationid}:
    get:
      summary: "Retrieve a single application"
      description: "Retrieve an application registered in the system"
      tags:
      - "api management"
      - "api partner application"
      parameters:
      - name: "applicationid"
        in: "path"
        description: "API Application ID"
        required: true
        schema:
          type: "string"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/APIPartnerApplication"
        404:
          description: "Not Found"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    delete:
      summary: "Delete a single application"
      description: "Delete an application registered in the system"
      tags:
      - "api management"
      - "api partner application"
      parameters:
      - name: "applicationid"
        in: "path"
        description: "API Application ID"
        required: true
        schema:
          type: "string"
      responses:
        201:
          description: "Delete confirmation"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /apimgr/application:
    post:
      summary: "Creates an application"
      description: "Creates an application registered in the system"
      tags:
      - "api management"
      - "api partner application"
      requestBody:
        description: "API Partner Application to create"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/APIPartnerApplication"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/APIPartnerApplication"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    put:
      summary: "Update an application"
      description: "Updates an application registered in the system"
      tags:
      - "api management"
      - "api partner application"
      requestBody:
        description: "API Partner Application to update"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/APIPartnerApplication"
      responses:
        201:
          description: "Update confirmation"
        default:
          description: "unexpected error"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    APIPartner:
      type: "object"
      description: "API Partner"
      properties:
        id:
          description: "Unique ID of this partner."
          type: "string"
        name:
          description: "Name of this API Partner"
          type: "string"
        description:
          description: "Description of the API Partner"
          type: "string"
        contact:
          description: "Contact information"
          type: "string"
        applicationids:
          description: "List of application IDs identifying each partner application\
            \ that is registered for this partner."
          type: "array"
          items:
            description: "Application ID"
            type: "string"
        roles:
          description: "The roles assigned to this partner. The roles will be matched\
            \ against API roles so applications in this partner can only subscripe\
            \ to API complying with these roles"
          type: "array"
          items:
            description: "Role name"
            type: "string"
        developers:
          description: "List of developers of this application"
          type: "array"
          items:
            type: "object"
            properties:
              id:
                description: "Developer ID"
                type: "string"
              role:
                description: "Role name (OWNER, READ_ONLY, NONE)"
                type: "string"
                enum:
                - "OWNER"
                - "READ_ONLY"
                - "NONE"
    APIDeveloper:
      type: "object"
      properties:
        id:
          description: "The ID of this API Developer - cannot be changed after the\
            \ developer has been created."
          type: "string"
        credentials:
          description: "The credentials this user is using to log into the developer\
            \ portal (matching a challenge in the user admin database)"
          type: "string"
        email:
          description: "Contact email for the API developer"
          type: "string"
        partners:
          description: "A list of API Partners this developer is assigned to and which\
            \ role"
          type: "array"
          items:
            type: "object"
            properties:
              id:
                description: "The UID of the partner"
                type: "string"
              role:
                description: "The developer role for this partner (OWNER, READ_ONLY,\
                  \ NONE)"
                type: "string"
                enum:
                - "OWNER"
                - "READ_ONLY"
                - "NONE"
        applications:
          description: "A list of API Partner Applications this developer is assigned\
            \ to and which role"
          type: "array"
          items:
            type: "object"
            properties:
              id:
                description: "The UID of the application"
                type: "string"
              role:
                description: "The developer role for this partner (OWNER, READ_ONLY,\
                  \ DEVELOPER)"
                type: "string"
                enum:
                - "OWNER"
                - "READ_ONLY"
                - "DEVELOPER"
    APIPartnerApplication:
      description: "API Partner Application"
      type: "object"
      properties:
        id:
          description: "Unique ID of this Application"
          type: "string"
        name:
          description: "Name of this API Partner application"
          type: "string"
        description:
          description: "Description of the API Partner application"
          type: "string"
        partner_id:
          description: "Unique ID of the application this partner is linked to"
          type: "string"
        client_id:
          description: "The client ID that can authenticate this application"
          type: "string"
        client_secret:
          description: "The secret for the provided client id mentioned above"
          type: "string"
        apikeys:
          description: "List of API keys that can be used to authenticate this application\
            \ if allowed"
          type: "array"
          items:
            description: "API Key"
            type: "string"
        allowed_scopes:
          description: "Specifies which scopes the application is allowed to request."
          type: "array"
          items:
            description: "OAuth2 Scope name"
            type: "string"
        valid_grant_types:
          description: "The allowed grant types that this application is allowed to\
            \ use"
          type: "array"
          items:
            description: "grant type name"
            type: "string"
        accesstoken_type:
          description: "The type of OAuth2 access token can be either UUID, or JWT\
            \ - if it is a UUID, it can be used as a key - e.g. a bearer token, which\
            \ is presented during authentication. If JWT, the access token is a signed\
            \ JWT (JSON Web Token) containing information about the user"
          type: "string"
          enum:
          - "UUID"
          - "JWT"
        allowed_uris:
          description: "OAuth2 redirect URIs for the application"
          type: "array"
          items:
            description: "Redirect URI"
            type: "string"
        allowed_logout_uris:
          description: "OAuth2 Logout URIs which are allowed for this application"
          type: "array"
          items:
            description: "Logout URI"
            type: "string"
        accesstoken_valid_seconds:
          description: "If set, overrides the time an issued OAuth2 access token is\
            \ valid for"
          type: "integer"
        refreshtoken_validity_seconds:
          description: "If set, this is the number of seconds that an OAuth2 access\
            \ token is valid for."
          type: "integer"
        subscriptions:
          description: "List of JSON Objects with API unique ID as key and subscription\
            \ plan unique ID as value."
          type: "array"
          items:
            type: "object"
        pending_subscriptions:
          description: "List of JSON objects with pending subscriptions requests."
          type: "array"
          items:
            type: "object"
            properties:
              appid:
                type: "string"
                description: "API ID"
              subscriptionplan_id:
                type: "string"
                description: "Subscription Plan ID"
              comment_requestor:
                type: "string"
                description: "Comment made by the requestor when requesting the subscription"
              comment_response:
                type: "string"
                description: "Comment made by the approver/rejector"
              unread:
                type: "boolean"
                description: "True if unread by API Partner"
              action_id:
                type: "string"
                description: "ID of corresponding Action created for this request"
              approved:
                type: "boolean"
                description: "True, if request has been approved by administrator"
              rejected:
                type: "boolean"
                description: "True, if request has been rejected by administrator"
        developers:
          description: "List of objects with developers"
          type: "array"
          items:
            type: "object"
            properties:
              id:
                description: "The UID of the developer"
                type: "string"
              role:
                description: "The developer role for this application"
                type: "string"
                enum:
                - "OWNER"
                - "DEVELOPER"
                - "READ_ONLY"
        certificates:
          description: "List of JSON objects with SSL/TLS client certificate information"
          type: "array"
          items:
            type: "object"
            properties:
              subject:
                description: "Certificate Subject DN"
                type: "string"
              issuer:
                description: "Certificate Issuer DN"
                type: "string"
              certificate:
                description: "certificate, DER encoded and base64 encoded. Subject\
                  \ and Issuer MUST match the certificate."
                type: "string"
              developer:
                description: "ID of developer who added the certificate in developer\
                  \ portal, if any."
                type: "string"
              certificate.allow.expired:
                description: "True, if expired certificate is allowed"
                type: "boolean"
              certificate.skip.chain.checks:
                description: "True, if certificate chain, revocation etc. check should\
                  \ be skipped and request trusted if client cert matches this cert."
                type: "boolean"
    Error:
      required:
      - "code"
      - "message"
      properties:
        code:
          description: "Error code"
          type: "integer"
          format: "int32"
        message:
          description: "Error message"
          type: "string"
  securitySchemes:
    client_id_secret:
      type: "http"
      scheme: "basic"
      description: "Basic authentication using client_id and client_secret from API\
        \ Partner Application"
security:
- client_id_secret: []
servers:
- url: "https://127.0.0.1:9443/api/v1"
  description: "Internal APIs are exposed here, such as APIs for Administration"