x-generator: NSwag v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v11.0.0.0))
swagger: '2.0'
info:
  title: Absorb Integration API
  version: v2
consumes:
  - application/json
produces:
  - application/json
paths:
  /enrollment-keys/{enrollmentKeyId}:
    get:
      tags:
        - Enrollment Keys
      summary: Get enrollment key.
      operationId: EnrollmentKeys_GetEnrollmentKey
      parameters:
        - type: string
          name: enrollmentKeyId
          in: path
          required: true
          description: The ID of the enrollment key.
          format: guid
          x-nullable: false
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '2'
      responses:
        '200':
          x-nullable: false
          description: ''
          schema:
            $ref: '#/definitions/EnrollmentKeyResource'
        '404':
          x-nullable: false
          description: Enrollment Key not found.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
    post:
      tags:
        - Enrollment Keys
      summary: Update enrollment key.
      operationId: EnrollmentKeys_UpdateEnrollmentKey
      parameters:
        - type: string
          name: enrollmentKeyId
          in: path
          required: true
          description: The ID of the enrollment key.
          format: guid
          x-nullable: false
        - name: updateEnrollmentKeyRequestBody
          in: body
          description: The body for the enrollment key data.
          schema:
            $ref: '#/definitions/UpdateEnrollmentKeyRequestBody'
          x-nullable: true
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '2'
      responses:
        '200':
          description: ''
        '404':
          x-nullable: false
          description: Enrollment key not found.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
        '422':
          x-nullable: false
          description: A validation error occured with the provided parameters.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
  /enrollment-keys:
    get:
      tags:
        - Enrollment Keys
      summary: Get enrollment key by external ID.
      operationId: EnrollmentKeys_GetEnrollmentKeyByExternalId
      parameters:
        - type: string
          name: externalId
          in: query
          required: true
          description: The ID of the enrollment key.
          x-nullable: true
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '2'
      responses:
        '200':
          x-nullable: false
          description: ''
          schema:
            $ref: '#/definitions/EnrollmentKeyResource'
        '404':
          x-nullable: false
          description: Enrollment key not found.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
        '422':
          x-nullable: false
          description: A validation error occured with the provided parameters.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
    post:
      tags:
        - Enrollment Keys
      summary: Create enrollment key.
      operationId: EnrollmentKeys_CreateEnrollmentKey
      parameters:
        - name: request
          in: body
          description: Request to create a new enrollment key.
          schema:
            $ref: '#/definitions/CreateEnrollmentKeyRequest'
          x-nullable: true
        - type: string
          name: x-api-key
          in: header
        - type: string
          name: x-api-version
          in: header
          description: '2'
      responses:
        '201':
          x-nullable: false
          description: ''
          schema:
            $ref: '#/definitions/EnrollmentKeyResource'
        '422':
          x-nullable: false
          description: A validation error occured with the provided parameters.
          schema:
            $ref: '#/definitions/GenericErrorResponse'
      security:
        - api_key: []
definitions:
  EnrollmentKeyResource:
    type: object
    description: >-
      Represents information about an enrollment key for an Integration API
      endpoint.
    properties:
      id:
        type: string
        description: The unique enrollment key identifier.
        format: guid
      name:
        type: string
        description: The enrollment key's name.
      keyName:
        type: string
        description: The enrollment key's key name.
      departmentId:
        type: string
        description: The enrollment key's department ID.
        format: guid
      usernameType:
        description: >-
          The enrollment key's username type.


          Possible Enum Values: `0 = UserInput` `1 = Email` `2 =
          FirstNameLastName` 
        allOf:
          - $ref: '#/definitions/UsernameTypes'
      maxUses:
        type: integer
        description: The enrollment key's max uses.
        format: int32
      timesUsed:
        type: integer
        description: The enrollment key's times used.
        format: int32
      dateAdded:
        type: string
        description: The enrollment key's date added.
      dateEdited:
        type: string
        description: The enrollment key's date edited.
      startDate:
        type: string
        description: >-
          The enrollment key's start date. If not set, the key is immediately
          redeemable.
      expiryDate:
        type: string
        description: The enrollment key's expiry date. If not set, the key never expires.
      languageId:
        type: integer
        description: The enrollment key's language ID.
        format: int32
      sendNewUserMessageOnEnrollment:
        type: boolean
        description: >-
          True if a new user message will be sent upon enrollment, false
          otherwise. 
      externalId:
        type: string
        description: The enrollment key's external ID.
      courses:
        type: array
        description: The enrollment key's courses.
        items:
          $ref: '#/definitions/EnrollmentKeyCourseResource'
      signupFields:
        type: array
        description: The enrollment key's signup fields.
        items:
          $ref: '#/definitions/SignupFieldResource'
  Link:
    type: object
    properties:
      Rel:
        $ref: '#/definitions/Relation'
      Items:
        type: array
        items:
          $ref: '#/definitions/LinkItem'
  Relation:
    type: object
    properties:
      Name:
        type: string
  LinkItem:
    type: object
    properties:
      Href:
        type: string
      Name:
        type: string
      Templated:
        type: boolean
      Type:
        type: string
      Deprecation:
        type: string
      Profile:
        type: string
      Title:
        type: string
      Hreflang:
        type: string
  IEmbeddedResource:
    type: object
    x-abstract: true
    properties:
      Name:
        type: string
      Resources:
        type: array
        items:
          $ref: '#/definitions/IResource'
  IResource:
    type: object
    x-abstract: true
    properties:
      Links:
        type: array
        items:
          $ref: '#/definitions/Link'
      EmbeddedResources:
        type: array
        items:
          $ref: '#/definitions/IEmbeddedResource'
  UsernameTypes:
    type: integer
    description: ''
    x-enumNames:
      - UserInput
      - Email
      - FirstNameLastName
    enum:
      - 0
      - 1
      - 2
  EnrollmentKeyCourseResource:
    type: object
    description: >-
      Represents information about an enrollment key course for an Integration
      API endpoint.
    properties:
      courseId:
        type: string
        description: The enrollment key course's course ID.
        format: guid
      sessionId:
        type: string
        description: The enrollment key course's session ID, if applicable.
        format: guid
      courseCollectionId:
        type: string
        description: The enrollment key course's collection ID.
        format: guid
  SignupFieldResource:
    type: object
    description: >-
      Represents information about enrollment key signup fields for an
      Integration API endpoint.
    properties:
      customFieldDefinitionId:
        type: string
        description: >-
          The field's custom field definition ID, or
          00000000-0000-0000-0000-000000000000 if default definition.
        format: guid
      name:
        type: string
        description: The field's name.
      behavior:
        description: >-
          The field's behavior.


          Possible Enum Values: `0 = Optional` `1 = Required` `2 = Hidden` `3 =
          Locked` `4 = ReadOnly` 
        allOf:
          - $ref: '#/definitions/CustomFieldBehaviors'
      isBehaviorChangeable:
        type: boolean
        description: True if the field's behavior is changeable, false otherwise.
      type:
        description: >-
          The field's type.


          Possible Enum Values: `0 = Boolean` `1 = Date` `2 = DateTime` `3 =
          Decimal` `4 = Integer` `5 = Text` 
        allOf:
          - $ref: '#/definitions/FieldDefinitionTypes'
      defaultValue:
        type: string
        description: The field's default value.
  CustomFieldBehaviors:
    type: integer
    description: ''
    x-enumNames:
      - Optional
      - Required
      - Hidden
      - Locked
      - ReadOnly
    enum:
      - 0
      - 1
      - 2
      - 3
      - 4
  FieldDefinitionTypes:
    type: integer
    description: ''
    x-enumNames:
      - Boolean
      - Date
      - DateTime
      - Decimal
      - Integer
      - Text
    enum:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
  GenericErrorResponse:
    type: object
    description: |-
      This class is NOT to be used as an actual response. This is to be used as
      the return type for non-200 responses in `SwaggerResponse` attributes.
    properties:
      validations:
        type: array
        description: The validations (if any) which caused the error.
        items:
          type: string
      code:
        description: The status code returned.
        allOf:
          - $ref: '#/definitions/HttpStatusCode'
      message:
        type: string
        description: The error message.
      term:
        type: string
        description: The general error term.
      _meta:
        type: object
        description: 'A list of meta data (if any). '
        additionalProperties:
          type: string
  HttpStatusCode:
    type: integer
    description: ''
    x-enumNames:
      - Continue
      - SwitchingProtocols
      - OK
      - Created
      - Accepted
      - NonAuthoritativeInformation
      - NoContent
      - ResetContent
      - PartialContent
      - MultipleChoices
      - Ambiguous
      - MovedPermanently
      - Moved
      - Found
      - Redirect
      - SeeOther
      - RedirectMethod
      - NotModified
      - UseProxy
      - Unused
      - TemporaryRedirect
      - RedirectKeepVerb
      - BadRequest
      - Unauthorized
      - PaymentRequired
      - Forbidden
      - NotFound
      - MethodNotAllowed
      - NotAcceptable
      - ProxyAuthenticationRequired
      - RequestTimeout
      - Conflict
      - Gone
      - LengthRequired
      - PreconditionFailed
      - RequestEntityTooLarge
      - RequestUriTooLong
      - UnsupportedMediaType
      - RequestedRangeNotSatisfiable
      - ExpectationFailed
      - UpgradeRequired
      - InternalServerError
      - NotImplemented
      - BadGateway
      - ServiceUnavailable
      - GatewayTimeout
      - HttpVersionNotSupported
  CreateEnrollmentKeyRequest:
    type: object
    description: Represents an API request to create an enrollment key.
    required:
      - name
      - keyName
    properties:
      name:
        type: string
        description: >-
          Key name, only visible to admins and meant to be used for easy
          identification.
        minLength: 1
      keyName:
        type: string
        description: >-
          The unique key name that will be entered by a user to redeem this
          enrollment key.
        minLength: 1
      departmentId:
        type: string
        description: >-
          New accounts created with this key will be created in this department.

          If not specified, the top-level department for the authenticated user
          will be used.
        format: guid
      usernameType:
        description: >-
          Specifies how usernames will be generated when new accounts are
          created using this enrollment key.

          If not specified, the Email type will be used.


          Possible Enum Values: `0 = UserInput` `1 = Email` `2 =
          FirstNameLastName` 
        allOf:
          - $ref: '#/definitions/UsernameTypes2'
      maxUses:
        type: integer
        description: >-
          Maximum times the enrollment key can be used. If you do not send this
          value or send null for this value the key will have unlimited uses.
        format: int32
      startDate:
        type: string
        description: >-
          The enrollment key will not be redeemable until this date. If not set,
          the key is immediately redeemable.
      expiryDate:
        type: string
        description: >-
          The enrollment key will not be redeemable after this date. If not set,
          the key never expires.
      languageId:
        type: integer
        description: >-
          The number of the language to be used in the Enrollment Key
          instructions email.

          Will default to 1 (English) if not provided.
        format: int32
      sendNewUserMessageOnEnrollment:
        type: boolean
        description: >-
          Should a user creating a new account using this enrollment key receive
          a welcome email? Default is false.
      externalId:
        type: string
        description: >-
          When specified, associates the enrollment key with an externally
          provide identifier.
        maxLength: 255
        minLength: 0
      courses:
        type: array
        description: >-
          The courses the user will be enrolled into upon redemption of this
          enrollment key.
        items:
          $ref: '#/definitions/EnrollmentKeyCourseRequest'
      signupFields:
        type: array
        description: >-
          Overrides for the fields the user can fill in to create their new
          account when using this enrollment key.

          The defaults are set on the client and will always be used, but these
          fields allow some of those behaviours to be overridden.
        items:
          $ref: '#/definitions/CreateSignupFieldRequest'
  UsernameTypes2:
    type: integer
    description: Enumeration for different username types.
    x-enumNames:
      - UserInput
      - Email
      - FirstNameLastName
    enum:
      - 0
      - 1
      - 2
  EnrollmentKeyCourseRequest:
    type: object
    description: Represents a request to create/update an enrollment key's courses
    required:
      - courseId
    properties:
      courseId:
        type: string
        description: The enrollment key course's course ID.
        format: guid
        minLength: 1
      sessionId:
        type: string
        description: The enrollment key course's session ID, if applicable.
        format: guid
      courseCollectionId:
        type: string
        description: The enrollment key course's collection ID.
        format: guid
  CreateSignupFieldRequest:
    type: object
    description: >-
      Represents an API request to override an existing field definition
      Behavior/DefaultValue.
    required:
      - customFieldDefinitionId
      - behavior
    properties:
      customFieldDefinitionId:
        type: string
        description: >-
          If overriding a Custom Field Definition, this is its unique
          identifier. Otherwise use 00000000-0000-0000-0000-000000000000
        format: guid
      name:
        type: string
        description: >-
          The name of the field, either the Default Field or Custom Field
          Definition.
      behavior:
        description: >-
          How this user field behaves when a user is creating a new account.


          Possible Enum Values: `0 = Optional` `1 = Required` `2 = Hidden` `3 =
          Locked` `4 = ReadOnly` 
        allOf:
          - $ref: '#/definitions/CustomFieldBehaviors2'
      defaultValue:
        type: string
        description: >-
          The value matching the Type that will be pre-populated in this field
          when the EnrollmentKey is used to create a new user account.

          If this is a Date or DateTime it must be in the ISO-8601 DateTime
          format with optional milliseconds, e.g.: 2016-11-09T18:22:27.4044323Z
  CustomFieldBehaviors2:
    type: integer
    description: Enum specifying the type of custom field behavior.
    x-enumNames:
      - Optional
      - Required
      - Hidden
      - Locked
      - ReadOnly
    enum:
      - 0
      - 1
      - 2
      - 3
      - 4
  UpdateEnrollmentKeyRequestBody:
    type: object
    description: The request to update an enrollment key.
    properties:
      name:
        type: string
        description: >-
          Key name, only visible to admins and meant to be used for easy
          identification.
      keyName:
        type: string
        description: >-
          The unique key name that will be entered by a user to redeem this
          enrollment key.
      departmentId:
        type: string
        description: New accounts created with this key will be created in this department.
        format: guid
      usernameType:
        description: >-
          The key will create a username for the new user based on this
          selection.


          Possible Enum Values: `0 = UserInput` `1 = Email` `2 =
          FirstNameLastName` 
        allOf:
          - $ref: '#/definitions/UsernameTypes2'
      maxUses:
        type: integer
        description: >-
          Maximum times the enrollment key can be used. If you do not send this
          value or send null for this value the key will have unlimited uses.
        format: int32
      startDate:
        type: string
        description: >-
          The enrollment key will not be redeemable until this date. If not set,
          the key is immediately redeemable.
      expiryDate:
        type: string
        description: >-
          The enrollment key will not be redeemable after this date. If not set,
          the key never expires.
      languageId:
        type: integer
        description: >-
          The number of the language to be used in the Enrollment Key
          instructions email.

          Will default to 1 (English) if not provided.
        format: int32
      sendNewUserMessageOnEnrollment:
        type: boolean
        description: >-
          Should a user creating a new account using this enrollment key receive
          a welcome email? Default is false.
      externalId:
        type: string
        description: Externally provided identifier for this enrollment key.
      courses:
        type: array
        description: >-
          The courses the user will be enrolled into upon redemption of this
          enrollment key.
        items:
          $ref: '#/definitions/EnrollmentKeyCourseRequest'
      signupFields:
        type: array
        description: >-
          Overrides for the fields the user can fill in to create their new
          account when using this enrollment key.

          The defaults are set on the client and will always be used, but these
          fields allow some of those behaviours to be overridden.
        items:
          $ref: '#/definitions/UpdateSignupFieldRequest'
  UpdateSignupFieldRequest:
    type: object
    description: Represents a request to update an existing SignupField.
    required:
      - customFieldDefinitionId
      - name
      - behavior
    properties:
      customFieldDefinitionId:
        type: string
        description: >-
          If overriding a Custom Field Definition, this is its unique
          identifier. Otherwise use 00000000-0000-0000-0000-000000000000
        format: guid
        minLength: 1
      name:
        type: string
        description: >-
          The name of the field, either the Default Field or Custom Field
          Definition.
        minLength: 1
      behavior:
        description: >-
          How this user field behaves when a user is creating a new account.


          Possible Enum Values: `0 = Optional` `1 = Required` `2 = Hidden` `3 =
          Locked` `4 = ReadOnly` 
        allOf:
          - $ref: '#/definitions/CustomFieldBehaviors2'
      defaultValue:
        type: string
        description: >-
          The value matching the Type that will be pre-populated in this field
          when the EnrollmentKey is used to create a new user account.

          If this is a Date or DateTime it must be in the ISO-8601 DateTime
          format with optional milliseconds, e.g.: 2016-11-09T18:22:27.4044323Z
securityDefinitions:
  api_key:
    type: apiKey
    name: x-api-key
    in: header
tags:
  - name: Enrollment Keys
x-servers:
  - url: https://rest.myabsorb.com
    description: US
  - url: https://rest.myabsorb.ca
    description: CA
  - url: https://rest.myabsorb.eu
    description: EU
  - url: https://rest.myabsorb.com.au
    description: AU
