swagger: '2.0'

info:
  title: Transfers

  description: >-
    With the Transfers API, clients can schedule
    transfer requests to move funds from one account to another.
    To schedule a new transfer, use the `POST` operation
    at `/scheduledTransfers` path. The `GET` operation there
    returns a paginated collection of scheduled transfers.
    Scheduled transfers which have been processed are automatically
    removed from `/scheduledTransfers`.
    The `/pastTransfers` collection contains processed (or canceled)
    transfers.
    
    This differs from the Payments API which allows scheduling
    bill or other payments to external payees.
  version: 0.5.0

  contact:
    name: Apiture
    url: 'https://developer.aptiture.com'
    email: api@apiture.com

  termsOfService: 'TODO: Terms of Service is TBD; need input from Legal team.'

schemes:
  - https

basePath: /transfers

consumes:
  - application/hal+json
  - application/json

produces:
  - application/hal+json
  - application/json

tags:
  - name: API
    description: Endpoints which describe this API.
  - name: Scheduled Transfer
    description: Scheduled transfers from a source account to a target account
  - name: Transfer
    description: 'Deprecated; use Scheduled Transfer and Past Transfer operations'
  - name: Past Transfer
    description: Processed transfers
  - name: Configuration
    description: >-
      A set of endpoints that allows for the creation and retrieval of configuration options specific to this service

paths:
  /scheduledTransfers:
    get:
      summary: Return a collection of scheduled transfers
      description: >-
        Return a[ paginated](http://doc.apiture.com/api/concepts/pagination)[
        sortable](http://doc.apiture.com/api/concepts/sorting)[
        filterable](http://doc.apiture.com/api/concepts/filtering)[
        searchable](http://doc.apiture.com/api/concepts/searchable) collection
        of transfers. The [links](http://doc.apiture.com/api/concepts/links) in
        the response include pagination links.
      operationId: getScheduledTransfers
      tags:
        - Scheduled Transfer
      parameters:
        - name: start
          in: query
          description: >-
            The zero-based index of the first transfer item to include in this
            page. The default 0 denotes the beginning of the collection.
          type: integer
          format: int64
          default: 0
        - name: limit
          in: query
          description: >-
            The maximum number of transfer representations to return in this
            page.
          type: integer
          format: int32
          default: 100
        - name: sortBy
          in: query
          type: string
          description: >-
            Optional sort criteria. See [sort criteria
            format](http://docs.apiture.com/api/concepts/sorting#criteria), such
            as `?sortBy=field1,-field2`.
        - $ref: '#/parameters/filterQueryParam'
        - $ref: '#/parameters/qQueryParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/scheduledTransfers'
        '400':
          $ref: '#/responses/400'
        '422':
          $ref: '#/responses/422'
    post:
      summary: Create a new scheduled transfer request
      description: >-
        This operation adds either a new one-time or a recurring transfer, depending
        on the content of the embedded `schedule`. 
        The request includes the
        amount of the transfer in the body, and the source and target accounts in
        the request's `_links` via the link relations `apiture:source` and
        `apiture:target`. The accounts must be active and available for
        transfers and the amount must be in the allowed transfer range.
        <p>
        If the request's transfer date (`schedule.start`) is the current day,
        the financial institution is processing transfers on that day, and the time is
        _before_ the financial institution's transfer processing cutoff time, internal transfers
        will be processed as soon as possible and the transfer `state` will
        change to `processing` and then `completed`.
        If the request's transfer date (`schedule.start`) is the current day and the time is
        _past_ the cutoff time, the transfer will be processed on the _next_ processing day.
        The cutoff time is available as `cutoffTime` via
        this service's `basic` configuration values `GET /transfers/configuration/groups/basic/values`;
        those values are defined by the JSON schema `GET /transfers/configuration/groups/basic/schema`.
        <p>
        If the transfer is scheduled for a future date that 
        is _not_ a valid transfer processing day,
        the request fails with a 400 error.
        The holidays and other non-processing days are available via
        this service's `calendar` configuration values `GET /transfers/configuration/groups/calendar/values`;
        those values are defined by the JSON schema `GET /transfers/configuration/groups/calendar/schema`.
        <p>
        The service will reject duplicate requests, defined by a request
        that exactly matches an existing transfer (same `amount`, `schedule`,
        `description`, source and target accounts), returning a *409
        Conflict* status. To
        schedule a duplicate transfer with the same amount, schedule,
        and accounts, change at least the `description`.
        <p>
        Scheduled transfers will be deleted automatically at some point
        after they have completed (typically 7 days), up until which
        they are available with a `state` of `completed` if successful
        or `failed` if not.
      operationId: createScheduledTransfer
      tags:
        - Scheduled Transfer
      parameters:
        - name: transfer
          in: body
          description: The data necessary to create a new transfer.
          required: true
          schema:
            $ref: '#/definitions/createScheduledTransfer'
      responses:
        '201':
          description: Created
          schema:
            $ref: '#/definitions/scheduledTransfer'
          headers:
            Location:
              description: >-
                The URI of the new resource. If the URI begins with / it is
                relative to the API root context. Else, it is a full URI
                starting with *`scheme`*`://host`
              type: string
              format: uri
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update the resource.
              type: string
        '400':
          $ref: '#/responses/400'
        '404':
          $ref: '#/responses/404ScheduledTransfer'
        '409':
          description: >-
            Conflict.
            A conflict can occur for several reasons:

              * A transfer that matches the request
              already exists. The service does not allow
              duplicate transfer requests, which probably reflect accidental
              duplicate `POST` operations from the client.
              * The source or target accounts do not allow the transfer.
          schema:
            $ref: '#/definitions/error'
          x-apiture-errors:
            - duplicateTransfer
            - endDateIsEarlierThanStartDate
            - sourceAndTargetAccountsAreSame
  '/scheduledTransfers/{scheduledTransferId}':
    get:
      summary: Fetch a representation of this transfer
      description: >-
        Return a [HAL](http://docs.apiture.com/api/concepts/hal) representation
        of this transfer resource.

        To also receive the full
        account number when fetching an account, include the `?unmasked=true`
        option. When linking an external account, the full account number
        should be in the `accountNumbers.full` property in the request. 
      operationId: getScheduledTransfer
      tags:
        - Scheduled Transfer
      parameters:
        - $ref: '#/parameters/scheduledTransferIdPathParam'
        - $ref: '#/parameters/ifNoneMatchHeaderParam'
        - $ref: '#/parameters/unmaskedQueryParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/scheduledTransfer'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this transfer resource.
              type: string
        '304':
          $ref: '#/responses/304'
        '404':
          $ref: '#/responses/404ScheduledTransfer'

    delete:
      summary: Delete this scheduled transfer
      description: >-
        Delete this transfer. Any processing transfers may complete;
        future scheduled transfers, if this is a recurring transfer,
        will be canceled. After deleting a transfer, there is no
        direct access to the transactions or transaction errors.
      operationId: deleteScheduledTransfer

      tags:
        - Scheduled Transfer
      parameters:
        - $ref: '#/parameters/scheduledTransferIdPathParam'
      responses:
        '204':
          description: No Content
        '404':
          $ref: '#/responses/404ScheduledTransfer'

    patch:
      summary: Update this scheduled transfer
      description: >-
        Perform a partial update of this transfer. Fields which are omitted are
        not updated. Nested `_embedded` and `_links` are ignored if
        included.
        If the `state` of the transfer allow, this operation may change
        the description, amount, and schedule; the source and target accounts
        and `_embedded` objects may not be changed.
        In the schedule, the user may not changed the `count`.
        The user may not change the `state`. 
        <p>
        Future operations will include suspending, resuming, or canceling a recurring transfer.
        <p>
        This update operation is subject to the same constraints defined in the
        `createTransfer` (`POST /transfers/transfers`) operation.
      operationId: patchScheduledTransfer
      tags:
        - Scheduled Transfer
      parameters:
        - $ref: '#/parameters/scheduledTransferIdPathParam'
        - name: transfer
          in: body
          required: true
          schema:
            $ref: '#/definitions/updateScheduledTransfer'
        - $ref: '#/parameters/ifMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/transfer'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this transfer resource.
              type: string
        '400':
          $ref: '#/responses/400'
        '404':
          $ref: '#/responses/404ScheduledTransfer'
        '409':
          description: >-
            Conflict.
            A conflict can occur if another existing transfer matches the request
            exactly. If similar transfers are desired, ensure at least the
            `description` is unique.
        '412':
          $ref: '#/responses/412'
        '422':
          $ref: '#/responses/422ScheduledTransfer'
        '428':
          $ref: '#/responses/428'
  /suspendedScheduledTransfers:
    post:
      summary: Suspend a scheduled transfer
      description: >-
        `POST` the URI of a scheduled transfer to suspend it.
        This disables future recurring transfers until the
        scheduled transfer is either resumed or canceled.
        Any transfers that would have occurred on dates that passed while suspended
        will not be processed on those dates. 
        Use the `apiture:resume` or `apiture:cancel` links
        on the instance to resume or cancel the remaining transfers.
        This operation is only valid on scheduled transfers which
        are in the `scheduled` or `recurring` states.


        This operation is invoked by submitting a `POST` to the
        `href` in the scheduled transfer's *`apiture:suspend`* link,
        The link will be present if the transfer can be suspended.
      operationId: suspendScheduledTransfer
      x-apiture-implemented: true
      tags:
        - Scheduled Transfer
      parameters:
        - $ref: '#/parameters/scheduledTransferQueryParam'
        - $ref: '#/parameters/scheduledTransferUriQueryParam'
        - $ref: '#/parameters/ifMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/scheduledTransfer'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this transfer resource.
              type: string
        '400':
          description: >-
            Bad Request.
            The `scheduledTransferUri` was malformed or does not refer to a scheduled
            transfer.
          x-apiture-errors:
            - malformedTransferUri
        '409':
          description: >-
            Conflict.
            The specified scheduled transfer is in a state that
            does not allow suspending.
          x-apiture-errors:
            - updateTransferInvalidState
        '412':
          $ref: '#/responses/412'
        '422':
          $ref: '#/responses/422ScheduledTransfer'
        '428':
          $ref: '#/responses/428'
        '500':
          $ref: '#/responses/500ScheduledTransfer'
  /resumedScheduledTransfers:
    post:
      summary: Resume a suspended scheduled transfer
      description: >-
        `POST` the URI of a suspended scheduled transfer to resume it.
        This enables future recurring transfers.
        Any transfers that would have occurred on dates that passed while suspended
        will not be processed on those dates.
        See also the `extendSchedule` query parameter on this operation.
        This operation is only valid on scheduled transfers which
        are in the `suspended` state.


        This operation is invoked by submitting a `POST` to the
        `href` in the scheduled transfer's *`apiture:resume`* link,
        The link will be present if the transfer can be resumed.
      operationId: resumeScheduledTransfer
      x-apiture-implemented: true
      tags:
        - Scheduled Transfer
      parameters:
        - $ref: '#/parameters/scheduledTransferQueryParam'
        - $ref: '#/parameters/scheduledTransferUriQueryParam'
        - $ref: '#/parameters/ifMatchHeaderParam'
        - name: extendSchedule
          description: >-
            If true, the `schedule.end` will be extended if necessary
            so that the `maximumCount` number of transfers will
            be made (based on the periods in `every`.) 
            The default value (`false`) prevents
            processing transfers that the user may not expect
            based on the original schedule. (The user may still update
            the `schedule.end` via `PATCH` to the scheduled transfer.)
          in: query
          type: boolean
          default: false
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/scheduledTransfer'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this transfer resource.
              type: string
        '400':
          description: >-
            Bad Request.
            The `scheduledTransferUri` was malformed or does not refer to a scheduled
            transfer.
          x-apiture-errors:
            - malformedTransferUri
        '409':
          description: >-
            Conflict.
            The specified scheduled transfer is in a state that
            does not allow resuming.
          x-apiture-errors:
            - resumeTransferStateInvalidState
            - updateTransferInvalidState
        '412':
          $ref: '#/responses/412'
        '422':
          $ref: '#/responses/422ScheduledTransfer'
        '428':
          $ref: '#/responses/428'
        '500':
          $ref: '#/responses/500ScheduledTransfer'
  /canceledScheduledTransfers:
    post:
      summary: Cancel a scheduled transfer
      description: >-
        `POST` the URI of a scheduled transfer to cancel it.
        This cancels all future recurring transfers.
        Any transfers that would have occurred on future dates
        will be canceled.
        This operation is only valid on scheduled transfers which
        are in the `scheduled`, `recurring`, or `suspended` state.


        This operation is invoked by submitting a `POST` to the
        `href` in the scheduled transfer's *`apiture:cancel`* link,
        The link will be present if the transfer can be canceled.
      operationId: cancelScheduledTransfer
      x-apiture-implemented: true
      tags:
        - Scheduled Transfer
      parameters:
        - $ref: '#/parameters/scheduledTransferQueryParam'
        - $ref: '#/parameters/scheduledTransferUriQueryParam'
        - $ref: '#/parameters/ifMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/scheduledTransfer'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this transfer resource.
              type: string
        '400':
          description: >-
            Bad Request.
            The `scheduledTransferUri` was malformed or does not refer to a scheduled
            transfer.
          x-apiture-errors:
            - malformedTransferUri
        '409':
          description: >-
            Conflict.
            The specified scheduled transfer is in a state that
            does not allow cancelation.
          x-apiture-errors:
            - updateTransferInvalidState
        '412':
          $ref: '#/responses/412'
        '422':
          $ref: '#/responses/422ScheduledTransfer'
        '428':
          $ref: '#/responses/428'
        '500':
          $ref: '#/responses/500ScheduledTransfer'
  /pastTransfers:
    get:
      summary: Return a collection of past transfers

      description: >-
        Return a[ paginated](http://doc.apiture.com/api/concepts/pagination)[
        sortable](http://doc.apiture.com/api/concepts/sorting)[
        filterable](http://doc.apiture.com/api/concepts/filtering)[
        searchable](http://doc.apiture.com/api/concepts/searchable) collection
        of past transfers. The [links](http://doc.apiture.com/api/concepts/links) in
        the response include pagination links.
        <p>
        Past transfers are transfers which have been processed or
        canceled.
      operationId: getPastTransfers
      tags:
        - Past Transfer
      parameters:
        - name: start
          in: query
          description: >-
            The zero-based index of the first transfer item to include in this
            page. The default 0 denotes the beginning of the collection.
          type: integer
          format: int64
          default: 0
        - name: limit
          in: query
          description: >-
            The maximum number of transfer representations to return in this
            page.
          type: integer
          format: int32
          default: 100
        - name: sortBy
          in: query
          type: string
          description: >-
            Optional sort criteria. See [sort criteria
            format](http://docs.apiture.com/api/concepts/sorting#criteria), such
            as `?sortBy=field1,-field2`.
        - $ref: '#/parameters/filterQueryParam'
        - $ref: '#/parameters/qQueryParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/pastTransfers'
        '400':
          $ref: '#/responses/400'
        '422':
          $ref: '#/responses/422'
  '/pastTransfers/{pastTransferId}':
    get:
      summary: Fetch a representation of this past transfer
      description: >-
        Return a [HAL](http://docs.apiture.com/api/concepts/hal) representation
        of this transfer resource.
      operationId: getPastTransfer
      tags:
        - Past Transfer
      parameters:
        - $ref: '#/parameters/pastTransferIdPathParam'
        - $ref: '#/parameters/ifNoneMatchHeaderParam'
        - $ref: '#/parameters/unmaskedQueryParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/pastTransfer'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this transfer resource.
              type: string
        '304':
          $ref: '#/responses/304'
        '404':
          $ref: '#/responses/404PastTransfer'
  /configuration:
    get:
      summary: Configuration definition for this API
      description: Returns the configuration for this API
      operationId: getConfiguration
      x-apiture-implemented: true
      tags:
        - Configuration
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/configuration'
  /configuration/groups:
    get:
      summary: Return a collection of configuration groups
      description: >-
        Return a[ paginated](http://doc.apiture.com/api/concepts/pagination)[
        sortable](http://doc.apiture.com/api/concepts/sorting)[
        filterable](http://doc.apiture.com/api/concepts/filtering)[
        searchable](http://doc.apiture.com/api/concepts/searchable) collection
        of configuration groups. The [links](http://doc.apiture.com/api/concepts/links) in
        the response include pagination links.
      operationId: getConfigurationGroups
      tags:
        - Configuration
      parameters:
        - name: start
          in: query
          description: >-
            The zero-based index of the first configuration group item to include in this
            page. The default 0 denotes the beginning of the collection.
          type: integer
          format: int64
          default: 0
        - name: limit
          in: query
          description: >-
            The maximum number of configuration group representations to return in this
            page.
          type: integer
          format: int32
          default: 100
        - name: sortBy
          in: query
          type: string
          description: >-
            Optional sort criteria. See [sort criteria
            format](http://docs.apiture.com/api/concepts/sorting#criteria), such
            as `?sortBy=field1,-field2`.
        - $ref: '#/parameters/filterQueryParam'
        - $ref: '#/parameters/qQueryParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/configurationGroups'
        '400':
          $ref: '#/responses/400'
        '422':
          $ref: '#/responses/422'
  '/configuration/groups/{groupName}':
    get:
      summary: Fetch a representation of this configuration group
      description: >-
        Return a [HAL](http://docs.apiture.com/api/concepts/hal) representation
        of this configuration group resource.
      operationId: getConfigurationGroup
      tags:
        - Configuration
      parameters:
        - $ref: '#/parameters/configurationGroupNamePathParam'
        - $ref: '#/parameters/ifNoneMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/configurationGroup'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which may be
                provided in an `If-None-Match` request header for *`GET`* operations for this configuration group resource.
              type: string
        '304':
          $ref: '#/responses/304'
        '404':
          $ref: '#/responses/404ConfigurationGroup'

  '/configuration/groups/{groupName}/schema':
    get:
      summary: Fetch the schema for this configuration group
      description: >-
        Return a [HAL](http://docs.apiture.com/api/concepts/hal) representation
        of this configuration group schema resource.
      operationId: getConfigurationGroupSchema
      tags:
        - Configuration
      parameters:
        - $ref: '#/parameters/configurationGroupNamePathParam'
        - $ref: '#/parameters/ifNoneMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/configurationSchema'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`*
              type: string
        '304':
          $ref: '#/responses/304'
        '404':
          $ref: '#/responses/404ConfigurationGroup'
  '/configuration/groups/{groupName}/values':
    get:
      summary: Fetch the values for the specified configuration group
      description: >-
        Return a representation of this configuration group values resource.
      operationId: getConfigurationGroupValues
      tags:
        - Configuration
      parameters:
        - $ref: '#/parameters/configurationGroupNamePathParam'
        - $ref: '#/parameters/ifNoneMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/configurationValues'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`*
              type: string
        '304':
          $ref: '#/responses/304'
        '404':
          $ref: '#/responses/404ConfigurationGroup'
    put:
      summary: Update the values for the specified configuration group
      description: Perform a complete replacement of this set of values
      operationId: updateConfigurationGroupValues
      tags:
        - Configuration
      parameters:
        - $ref: '#/parameters/configurationGroupNamePathParam'
        - name: configuration group values
          in: body
          required: true
          schema:
            $ref: '#/definitions/configurationValues'
        - $ref: '#/parameters/ifMatchHeaderParam'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/configurationSchema'
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`*
              type: string
        '400':
          $ref: '#/responses/400'
        '404':
          $ref: '#/responses/404ConfigurationGroup'
        '412':
          $ref: '#/responses/412'
        '428':
          $ref: '#/responses/428'
  '/configuration/groups/{groupName}/values/{valueName}':
    get:
      summary: Fetch a single value associated with the specified configuration group
      description: >-
        Fetch a single value associated with this configuration group.
        This provides convenient access to the map of `values` of the configuration group.
        To update a specific value,
        use `PUT /transfers/configuration/groups/{groupName}/values/{valueName}` (operation `updateConfigurationGroupValue`).
      operationId: getConfigurationGroupValue
      tags:
        - Configuration
      parameters:
        - $ref: '#/parameters/configurationGroupNamePathParam'
        - $ref: '#/parameters/configurationGroupValueNamePathParam'
      responses:
        '200':
          description: OK
          schema:
            type: object
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this configuration group resource.
              type: string
        '404':
          $ref: '#/responses/404ConfigurationGroupOrValue'
    put:
      summary: Update a single value associated with the specified configuration group
      description: >-
        Update a single value associated with this configuration group.
        This provides convenient access to individual `values` of the configuration group
        as defined in the configuration group's `schema`. The request body must conform to 
        the configuration group's schema for the named `{valueName}`.
        This operation is idempotent.
        <p>
        To update a specific value, use `PUT /transfers/configuration/groups/{groupName}/values/{valueName}` (operation `updateConfigurationGroupValue`).
      operationId: updateConfigurationGroupValue
      tags:
        - Configuration
      parameters:
        - $ref: '#/parameters/configurationGroupNamePathParam'
        - $ref: '#/parameters/configurationGroupValueNamePathParam'
        - name: values
          in: body
          required: true
          schema:
            $ref: '#/definitions/attributes'

      responses:
        '200':
          description: OK
          schema:
            type: object
          headers:
            ETag:
              description: >-
                The `ETag` response header specifies an entity tag which must be
                provided in an `If-Match` request header for *`PUT`* or
                *`PATCH`* operations which update this configuration group resource.
              type: string

  /:
    get:
      summary: Top-level resources and operations in this API
      description: Return links to the top-level resources and operations in this API.
      operationId: getApi
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/root'
      tags:
        - API
  /apiDoc:
    get:
      summary: Return API definition document
      description: Return the OpenAPI document that describes this API.
      operationId: getApiDoc
      produces:
        - application/json
        - application/openapi+json;version=2.0
        - application/openapi+yaml;version=2.0
      responses:
        '200':
          description: OK
          schema:
            type: object
      tags:
        - API

parameters:
  pastTransferIdPathParam:
    name: pastTransferId
    description: The unique identifier of this scheduled transfer. This is an opaque string.
    in: path
    type: string
    required: true

  configurationGroupNamePathParam:
    name: groupName
    description: The unique name of this configuration group.
    in: path
    type: string
    required: true

  configurationGroupValueNamePathParam:
    name: valueName
    description: >-
      The unique name of a value in a configuration group.
      This is the name of the value in the `schema`.
      A `{valueName}` must be a simple identifier following
      the pattern _`letter [letter | digit | '-' | '_']*`_
    in: path
    type: string
    required: true

  scheduledTransferIdPathParam:
    name: scheduledTransferId
    description: The unique identifier of this scheduled transfer. This is an opaque string.
    in: path
    type: string
    required: true

  scheduledTransferUriQueryParam:
    name: scheduledTransferUri
    description: >-
      The URI of a scheduled transfer resource.
      This parameter is **deprecated** and will be removed in the next version.
      Use `?scheduledTransfer=` instead.
    in: query
    type: string

  scheduledTransferQueryParam:
    name: scheduledTransfer
    description: A server-generated key which identifies a scheduled transfer resource.
    in: query
    type: string
    required: true

  filterQueryParam:
    name: filter
    in: query
    description: >-
      Optional filter criteria. See
      [filtering](http://docs.apiture.com/api/concepts/filtering#criteria).
    type: string

  qQueryParam:
    name: q
    in: query
    description: >-
      Optional search string. See
      [searching](http://docs.apiture.com/api/concepts/searching).
    type: string

  ifMatchHeaderParam:
    name: If-Match
    description: >-
      The entity tag that was returned in the `ETag` response. This must match
      the current entity tag of the resource.
    in: header
    type: string

  ifNoneMatchHeaderParam:
    name: If-None-Match
    description: >-
      The entity tag that was returned in the `ETag` response. If the resource's
      current entity tag matches, the `GET` will return 304 (Not Modified) and
      no response body, else the resource representation will be returned.
    in: header
    type: string

  unmaskedQueryParam:
    name: unmasked
    description: >-
      When requesting a transfer, the full account number of the source
      and target accounts is not included in the response by default, for security reasons.
      Include this query parameter, with a value of `true`, to
      request that the response body includes the full account
      number. Such requests are auditable.
    type: boolean
    in: query
    required: false
    default: false

responses:
  '304':
    description: >-
      Not Modified. The resource has not been modified since it was last
      fetched.
  '400':
    description: >-
      Bad Request. 
      The request body or one or more of the query parameters was not well
      formed.  The `_error` field in the response will contain details about the
      request error.
    schema:
      $ref: '#/definitions/errorResponse'
    x-apiture-errors:
      - externalAccountIsNotVerified
      - inactiveAccount
      - invalidConfigurationGroup
      - invalidConfigurationValue
      - invalidDate
      - invalidExternalAccount
      - invalidScheduledTransfer
      - malformedAccountUri
      - malformedEveryField
      - malformedRequestBody
      - malformedTransferUri
      - missingAccountInTransfer
      - transferCannotBeToAndFromExternal
      - undefinedTransferId
  '412':
    description: >-
      Precondition Failed. The supplied `if-Match` header value does not match
      the most recent `ETag` response header value. The resource has changed in
      the interim.
    schema:
      $ref: '#/definitions/errorResponse'
  '422':
    description: >-
      Unprocessable Entity. One or more of the query parameters was well formed
      but otherwise invalid. The `_error` field in the response will contain
      details about the request error.
    schema:
      $ref: '#/definitions/errorResponse'
  '428':
    description: >-
      Precondition Required. The request did not include the required `if-Match`
      header. Resubmit with the operation, supplying the value of the `ETag` and
      the most recent state of the resource.
    schema:
      $ref: '#/definitions/errorResponse'

  404ScheduledTransfer:
    description: >-
      Not Found. There is no such resource at the specified
      `{Id}` The `_error` field in the response will contain details
      about the request error.
    schema:
      $ref: '#/definitions/error'
    x-apiture-errors:
      - invalidAccountId
      - invalidScheduledTransferId
  404PastTransfer:
    description: >-
      Not Found. There is no such past transfer resource at the specified
      `{transferId}` The `_error` field in the response will contain details
      about the request error.
    schema:
      $ref: '#/definitions/error'
    x-apiture-errors:
      - invalidPastTransferId
  404ConfigurationGroup:
    description: >-
      Not Found. There is no such configuration group resource at the specified
      `{groupName}` The `_error` field in the response will contain details
      about the request error.
    schema:
      $ref: '#/definitions/error'
    x-apiture-errors:
      - invalidGroupName
  404ConfigurationGroupOrValue:
    description: >-
      Not Found. There is either no such configuration group resource at the specified
      `{groupName}` or no such value at the specified `{valueName}`. 
      The `_error` field in the response will contain details about the request error.
    schema:
      $ref: '#/definitions/error'
    x-apiture-errors:
      - invalidValueName
  422ScheduledTransfer:
    description: >-
      Unprocessable Entity. One or more of the query parameters was well formed
      but otherwise invalid. The `_error` field in the response will contain
      details about the request error.
    schema:
      $ref: '#/definitions/errorResponse'
    x-apiture-errors:
      - invalidTransferState
  500ScheduledTransfer:
    description: >-
      Server Error. The server encountered an unexpected condition that prevented it from 
      fulfilling the request.
    schema:
      $ref: '#/definitions/errorResponse'
    x-apiture-errors:
      - setStatusFailed
      - updateTransferFailed

definitions:
  transferFields:
    title: Common Transfer Fields
    description: Fields of the transfer resource, used to build other model schema.
    properties:
      amount:
        description: >-
          The amount of the transfer. For a transfer, the amount must be
          positive. The funding account must have sufficient available funds.
          Financial institutions may impose an upper limit on the amount in a
          transfer which may be lower than the available balance.
        allOf:
          - $ref: '#/definitions/money'
        example:
          value: '345.50'
          currency: 'USD'
      description:
        description: A description of this transfer.
        type: string
        maxLength: 4096
        example: Car payment
      schedule:
        description: Describes when the transfer is scheduled to occur.
        allOf:
          - $ref: '#/definitions/schedule'
      type:
        description: >-
          The type of transfer. 
          <p>
          An `internal` transfer is one where both the
          source and target account reside within the
          current financial institution. `ach` (Automated Clearinghouse)
          is for standard cross-institution, U.S. only transfers.
          `ach` transfers are typically processed in batches.
          `wire` transfers (not implemented in this release),
          can be processed faster (they may not depend on batch processing)
          and can also involve financial institution outside the U.S.
          However, wire transfers have higher fees. 
          <p>
          This field is optional, but immutable after being set.
          The default is `ach` if either the source or target account is external,
          and `internal` if both accounts are internal.
          It is an error to set the type to `ach` or `wire` for
          transfers between internal accounts, or to set `type`
          to `internal` if either the source or target account
          is external.
        type: string
        enum:
          - internal
          - ach
          - wire
      visibility:
        description: >-
          The transfer may be visible or hidden.
          Some transfers are _micro-deposit_ ACH transfers into a local
          account from an external account as part of external account
          verification. These transfers are _hidden_ from the user:
          the user may only see the transfer amounts by viewing their
          external account (via that external financial institution).
          Hidden transfers are by default omitted from
          the `/scheduledTransfers` and `/pastTransfers` collections.
          Financial institution administrators, however, can
          view hidden transfers.
        type: string
        enum:
          - visible
          - hidden

  createScheduledTransfer:
    title: Create Scheduled Transfer
    required:
      - _links
      - amount
      - schedule
    description: >-
      Representation used to schedule a new transfer. The request includes the
      amount of the transfer and the schedule in the body,
      and the source and target accounts in
      the request's `_links` via the link relations `apiture:source` and
      `apiture:target`.
    allOf:
      - $ref: '#/definitions/abstractResource'
      - $ref: '#/definitions/transferFields'
    example:
      _profile: 'http://api.apiture.com/schemas/transfers/createScheduledTransfer/v1.0.0/profile.json'
      amount:
        value: '345.50'
        currency: USD
      description: Car payment
      schedule:
        start: '2018-02-05'
        maximumCount: 36
        every: P1M
        skipNext: false
        end: '2021-04-05'
      _links:
        'apiture:source':
          href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
        'apiture:target':
          href: /accounts/externalAccounts/599b8ab5-6925-4f58-90c5-f6aa5b05f9d9

  summaryScheduledTransfer:
    title: Scheduled Transfer Summary
    description: >-
      Summary representation of a scheduled transfer resource. The summary includes the
      transfer ID, description, amount, state, and schedule, and the
      `_links` indicate the source and target accounts. This
      representation normally does not contain any `_embedded` objects. If
      needed, call the `GET` operation on the item's `self` link to get
      `_embedded` objects. For transfers which have failed, the `_error`
      object will describe the error circumstances.
    allOf:
      - $ref: '#/definitions/abstractResource'
      - $ref: '#/definitions/transferFields'
      - type: object
        properties:
          state:
            description: >-
              The state of the transfer. This is a _derived_ and _immutable_
              value. The Transfers service processing updates the `state`.

              The `state` can be one of the following:
                * *`scheduled`* - 
              A transfer is `scheduled` after a new one-time transfer is
              approved; it is scheduled to occur in the future.
                * *`recurring`* -
              A transfer is `recurring` after a new recurring transfer is
              approved; it is scheduled to start in the future.
                * *`pendingApproval`* -
              The source or target account is an external account which has
              not been verified. The financial institution may review
              the transfer and approve or deny it (the state will change
              to `scheduled` or `failed`.)
                * *`processing`* -
              A transfer which has been begun and is currently being processed. A
              processing transfer cannot be modified (the amount or schedule may
              not be changed.) To change a recurring transfer, wait for the
              state to change back to `recurring`.
                * *`suspended`* -
              A scheduled recurring transfer which is temporarily suspended or
              paused. No further transfer of funds will occur until it
              is resumed. If it is resumed, any missed transfers will not be performed.
                * *`canceled`* -
              A transfer which has been canceled. No further transfer of funds
              will occur.  Canceled transfers cannot be restarted; create a new
              one instead, or suspend/resume them instead of canceling.
              A canceled transfer
              cannot be modified. **Note**: With the exception of
              skipping the next transfer, there is no way to cancel specific
              transfers within a recurring transfer; instead, suspend the
              transfer and resume it after the desired date has passed. 
                * *`failed`* -
              A transfer which failed. The `error` will indicate the cause. A
              completed transfer cannot be modified.
                * *`completed`* -
              A transfer which has completed successfully. A completed transfer
              cannot be modified.
              <p>
              The client may change state in a limited number of ways:
              suspending a scheduled or recurring transaction via
              `POST` to the `/suspendedScheduledTransfers`;
              resuming a suspended recurring transaction via
              `POST` to the `/resumedScheduledTransfers`;
              canceling a scheduled transaction via
              `POST` to the `/canceledScheduledTransfers`.
              These operations are available with the `apiture:suspend`, `apiture:resume`,
              `apiture:cancel` links, respectively, on an instance.
              canceled by `POST`ing to `/canceledTransfers`.
              No request body is used on these operations.

            type: string
            enum:
              - scheduled
              - recurring
              - processing
              - suspended
              - completed
              - canceled
              - failed
            example: scheduled
          _id:
            description: >-
              The unique identifier for this transfer resource. This is an
              immutable opaque string.
            type: string
    example:
      _id: 0399abed-fd3d-4830-a88b-30f38b8a365c
      _profile: 'http://api.apiture.com/schemas/transfers/summaryScheduledTransfer/v1.0.0/profile.json'
      _links:
        self:
          href: /transfers/scheduledTransfers/0399abed-fd3d-4830-a88b-30f38b8a365c
        'apiture:source':
          href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
        'apiture:target':
          href: /accounts/externalAccounts/599b8ab5-6925-4f58-90c5-f6aa5b05f9d9
      state: recurring
      amount:
        value: '345.50'
        currency: USD
      description: Car payment
      schedule:
        start: '2018-02-05'
        maximumCount: 36
        skippedCount: 1
        count: 11
        skipNext: false
        every: P1M
        end: '2021-04-05'

  summaryPastTransfer:
    title: Past Transfer Summary
    description: >-
      Summary representation of a past transfer resource. The summary includes the
      transfer ID, description, amount, state, and schedule, and the
      `_links` indicate the source and target accounts. This
      representation normally does not contain any `_embedded` objects. If
      needed, call the `GET` operation on the item's `self` link to get
      `_embedded` objects. For transfers which have failed, the `_error`
      object will describe the error circumstances.
    allOf:
      - $ref: '#/definitions/summaryScheduledTransfer'

  updateScheduledTransfer:
    title: Update Scheduled Transfer
    description: >-
      Representation used to update or patch an existing scheduled transfer.
      The representation includes the
      transfer ID, description, amount, state, and schedule, and the
      `_links` indicate the source and target accounts.
      An update to a transfer ignores the `_embedded` object.
    allOf:
      - $ref: '#/definitions/summaryScheduledTransfer'
    example:
      _id: 0399abed-fd3d-4830-a88b-30f38b8a365c
      _profile: 'http://api.apiture.com/schemas/transfers/scheduledTransfer/v1.0.0/profile.json'
      state: recurring
      amount:
        value: '356.40'
        currency: USD
      description: Car payment
      schedule:
        start: '2018-02-05'
        maximumCount: 36
        skippedCount: 1
        count: 11
        skipNext: true
        every: P1M
        end: '2021-04-05'
      _links:
        self:
          href: /transfers/scheduledTransfers/0399abed-fd3d-4830-a88b-30f38b8a365c
        'apiture:source':
          href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
        'apiture:target':
          href: /accounts/externalAccounts/599b8ab5-6925-4f58-90c5-f6aa5b05f9d9

  transferAccount:
    title: Transfer Account
    description: Summary properties of the source and target account for a transfer.
    properties:
      accountTitle:
        description: >-
          The title of the account. Traditionally, this is the name of the account holder.
        maxLength: 512
        type: string
        example: John Smith
      institutionName:
        description: 'The name of the financial institution.'
        type: string
        minLength: 2
        maxLength: 128
        example: 3rd Party Bank
        readOnly: true
      routingNumber:
        description: >-
          The account routing number which identifies the financial institution.
          The full routing number and full account number are required to fully
          identify the account.
        type: string
        minLength: 9
        maxLength: 32
        example: '021000021' 
        readOnly: true
      accountNumbers:
        description: The account numbers for this account
        type: object
        allOf:
          - $ref: '#/definitions/accountNumbers'
        readOnly: true
   
  accountNumbers:
    title: Account Numbers
    description: Different representations of an account number.
    properties:
      masked:
        description: >-
          A partial account number that does not contain all the
          digits of the full account number. This masked number appears in
          statements or in user experience presentation. 
          It is sufficient for a user to differentiate this account from other
          accounts they hold, but is not sufficient for
          initiating transfers, etc. The first character is
          the mask character and is repeated; this
          does not indicate that the full account number
          is the same as the mask length.
          This value is derived and immutable.
        type: string
        minLength: 9
        maxLength: 32
        readOnly: true
        example: '*************3210'
      full:
        description: >-
          The full account number. This value only appears
          when `?unmasked=true` is passed on the `GET` request. 
          Not included in the summary representation of the 
          account that is included in account collection responses.
        type: string
        minLength: 9
        maxLength: 32
        example: '9876543210'
  
  transferAttribution:
    title: Transfer Derived Fields
    description: Fields of transfers which are derived, used to build other schemas.
    properties:
      createdBy:
        description: The user who created/scheduled the transfer.
        type: string
        example: lucille-4700
      createdAt:
        description: The ISO 8601 date-time when the transfer was scheduled/created.
        type: string
        format: date-time
        example: '2018-05-08T13:37:57.375Z'
      modifiedBy:
        description: The user who last modified the scheduled transfer.
        type: string
        example: lucille-4700
      modifiedAt:
        description: The ISO 8601 date-time when the transfer was last modified.
        type: string
        format: date-time
        example: '2018-05-18T16:42:57.000Z'
      sourceAccount:
        description: Summary properties of the source account for a transfer
        type: object
        allOf:
          - $ref: '#/definitions/transferAccount'
      targetAccount:
        description: Summary properties of the target account for a transfer
        type: object
        allOf:
          - $ref: '#/definitions/transferAccount'
        

  scheduledTransfer:
    title: Scheduled Transfer
    description: >-
      Representation of a transfer resource: a transfer of funds from one
      account to another.  A transfer consists of an amount, a source account, a
      target account, and a schedule which specifies a one-time transfer or a
      recurring transfer.

      In addition to the normal `self` link, The links for a transfer include: 

        * **`apiture:transactions`** - the collection of completed transactions associated with this transfer.
        * **`apiture:source`** - The source account where funds will be debited.
        * **`apiture:target`** - The target account where funds will be credited.
        * **`apiture:cancel`** - Cancel a transfer; this link is only
        available if the transfer may be canceled.
        * **`apiture:suspend`** - Suspend a transfer; this link is only
        available if the transfer may be suspended.
        * **`apiture:suspend`** - Resume a suspended transfer; this link is only
        available if the transfer is suspended.
        * **`apiture:creator`** - The user or contact who scheduled the transfer

      The `_embedded` object contains `transactions`, which contains the first
      page of transactions matching this transfer, and the summary representations
      of the  `source` and `target` accounts.

    allOf:
      - $ref: '#/definitions/updateScheduledTransfer'
      - $ref: '#/definitions/transferAttribution'
    example:
      _id: 0399abed-fd3d-4830-a88b-30f38b8a365c
      _profile: 'http://api.apiture.com/schemas/transfers/scheduledTransfer/v1.0.0/profile.json'
      createdBy: lucille-4700
      createdAt: '2018-05-08T13:37:57.375Z'
      modifiedBy: lucille-4700
      modifiedAt: '2018-05-18T16:42:57.000Z'
      _links:
        self:
          href: /transfers/scheduledTransfers/0399abed-fd3d-4830-a88b-30f38b8a365c
        'apiture:source':
          href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
        'apiture:target':
          href: /accounts/externalAccounts/599b8ab5-6925-4f58-90c5-f6aa5b05f9d9
        'apiture:creator':
          href: /users/users/d076e102-facf-46e2-8ecf-bcdb531cd9e6
        'apiture:transactions':
          href: >-
            /transaction?transfer=/transfers/transfers/0399abed-fd3d-4830-a88b-30f38b8a365c
      _embedded:
        transactions:
          start: 0
          count: 3
          items:
            - _id: da8682e3-cc0b-4a1a-b8d2-8ce4dc45bf36
              occurredAt: '2018-02-05T11:10:00.375Z'
              amount:
                value: '345.50'
                currency: USD
                description: Car payment
            - _id: a847c5c7-4a34-4464-b514-5ca1680cc00d
              occurredAt: '2018-03-05T11:11:17.375Z'
              amount:
                value: '345.50'
                currency: USD
                description: Car payment
            - _id: d9ab0002-2cbb-4a4c-a01f-c3ce3ad20782
              occurredAt: '2018-04-05T11:11:17.375Z'
              amount:
                value: '345.50'
                currency: USD
                description: Car payment
        source:
          _id: 34f8bec8-3939-4b7e-9ad5-10ee059ab250
          _profile: 'http://api.apiture.com/schemas/accounts/summaryAccount/v1.0.0/profile.json'
          name: Personal Savings
          productName: Basic Personal Savings
          type: Personal Savings
          subtype: Basic Personal Savings
          state: active
          balance:
            value: '3450.30'
            available: '3450.30'
            currency: USD
          _links:
            self:
              href: 'http://api.apiture.com/accounts/34f8bec8-3939-4b7e-9ad5-10ee059ab250'
        target:
          _id: c9839d60-73e5-47ba-9676-ca8138e9494d
          _profile: 'http://api.apiture.com/schemas/accounts/summaryAccount/v1.0.0/profile.json'
          name: My Basic Checking
          productName: Basic Personal Checking
          type: Personal Checking
          subtype: Basic Personal Checking
          state: active
          balance:
            value: '450.12'
            available: '450.12'
            currency: USD
          _links:
            self:
              href: 'http://api.apiture.com/accounts/c9839d60-73e5-47ba-9676-ca8138e9494d'
        _links:
          self:
            href: >-
              /transaction?transfer=/transfers/transfers/0399abed-fd3d-4830-a88b-30f38b8a365c
      amount:
        value: '345.50'
        currency: USD
      description: Car payment
      state: recurring
      schedule:
        start: '2018-02-05'
        count: 3
        every: P1M
        end: '2021-04-05'

  configuration:
    title: Configuration
    description: >-
      Represents the configuration for the Transfers API
    properties:
      _links:
        $ref: '#/definitions/links'
    example:
      _links:
        self:
          href: /transfers/configuration/
        'apiture:groups':
          href: /transfers/configuration/groups

  configurationGroups:
    title: Configuration Group Collection
    description: >-
      Collection of configuration groups. The items in the collection are ordered in the
      `_embedded` object with name `items`. The top-level `_links` object may
      contain pagination links (`self`, `next`, `prev`, `first`, `last`,
      `collection`.)
    allOf:
      - $ref: '#/definitions/collection'
      - type: object
        properties:
          _embedded:
            type: object
            properties:
              items:
                description: An array containing a page of configuration group items.
                type: array
                items:
                  $ref: '#/definitions/configurationGroupSummary'
    example:
      _profile: 'http://api.apiture.com/schemas/transfers/configurationGroups/v1.0.0/profile.json'
      start: 10
      limit: 10
      count: 67
      name: configurationGroups
      _links:
        self:
          href: /transfers/configuration/groups?start=10&limit=10
        first:
          href: /transfers/configuration/groups?start=0&limit=10
        next:
          href: /transfers/configuration/groups?start=20&limit=10
        collection:
          href: /transfers/configuration/groups
      _embedded:
        items:
          - _profile: 'http://api.apiture.com/schemas/transfers/configurationGroup/v1.0.0/profile.json'
            _links:
              self:
                href: /configuration/groups/basic
              'apiture:configuration':
                href: /configuration
            name: basic
            label: Basic Settings
            description: The basic settings for the Transfers API
          - _profile: 'http://api.apiture.com/schemas/transfers/configurationGroup/v1.0.0/profile.json'
            _links:
              self:
                href: /configuration/groups/calendar
              'apiture:configuration':
                href: /configuration
            name: calendar
            label: Calendar
            description: A calendar that specifies which dates are valid for performing transfers (e.g., weekdays excluding federal holidays)

  configurationGroupSummary:
    title: Configuration Group Summary
    description: >-
      A summary of the data contained within a configuration group resource
    allOf:
      - $ref: '#/definitions/abstractResource'
      - type: object
        properties:
          name:
            description: >-
              The name of this configuration group, must be unique within the set of all resources of this type.
            type: string
            maxLength: 48
            minLength: 1
            pattern: '[a-zA-Z][-\w_]*'
            example: transfers
          label:
            description: >-
              The text label for this resource, suitable for presentation to
              the client.
            type: string
            maxLength: 128
            minLength: 1
            example: 'Transfers Configuration'
          description:
            description: >-
              The full description for this resource, suitable for presentation to
              the client.
            type: string
            maxLength: 4096
            minLength: 1
            example: >-
              The configuration for the Transfers API.

  configurationGroup:
    title: Configuration Group
    description: >-
      Represents a configuration group.
    allOf:
      - $ref: '#/definitions/configurationGroupSummary'
      - type: object
        properties:
          schema:
            $ref: '#/definitions/configurationSchema'
          values:
            $ref: '#/definitions/configurationValues'
    example:
      _profile: 'http://api.apiture.com/schemas/transfers/configurationGroup/v1.0.0/profile.json'
      _links:
        self:
          href: /configuration/groups/basic
        'apiture:configuration':
          href: /configuration
      name: basic
      label: Basic Settings
      description: The basic settings for the Transfers API
      schema:
        type: object
        properties:
          dailyLimit:
            type: number
            description: The daily limit for the number of transfers
          cutoffTime:
            type: string
            format: time
            description: The cutoff time for scheduling transfers for the current day
      values:
        dailyLimit: 5
        cutoffTime: '17:30:00'

  configurationSchema:
    title: Configuration Schema
    description: >-
      The schema which defines the name and types of the
      variables that are part of this configuration definition.
      Property names must be simple identifiers
      consisting of alphanumeric characters, `-`, `_`
      following the pattern _`letter [letter | digit | '-' | '_']*`_

      This is implicitly a schema for `type: object`
      and contains the properties.


      The `values` in a configuration conform to the schema.
      The names and types are described with a subset of
      [JSON Schema Core](https://tools.ietf.org/html/draft-zyp-json-schema-04)
      and [JSON Schema Validation](https://tools.ietf.org/html/draft-fge-json-schema-validation-00)
      similar to that used to define schemas in
      [OpenAPI Specification 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject).
    example:
      type: object
      properties:
        dailyLimit:
          type: number
          description: The daily limit for the number of transfers
        cutoffTime:
          type: string
          format: time
          description: The cutoff time for scheduling transfers for the current day

  configurationValues:
    title: Configuration Values
    description: >-
      The data associated with this configuration: the resource's
      variable names and values. These values must conform to this
      item's `schema`.               
        
      *Note*: the `schema` may also contain `default` values
      which, if present, are used if a value is *not* set in the
      definition's `values`.
      (For example, multiple configurations may use the same schema
      that defines values `a`, `b`, and `c`, but each configuration
      may have their own unique values for `a`, `b`, and `c`
      which is separate from the schema.)
    example:
      dailyLimit: 5
      cutoffTime: '17:30:00'

  pastTransfer:
    title: Past Transfer
    description: >-
      Represents a transfer that has been processed or canceled
      (one that is no longer scheduled.)
      <p>
      If the `state` of the processed transfer is `failed`,
      the `_error` object will contain details of the failure,
      including a `message`. The `_error.type` field
      will be an identifier string, one of:
       * **`insufficientFunds`** - the source account did not have sufficient
       funds at the time the transfer was processed.
       * **`frozenAccount`** - The source or target account was frozen
       at the time the transfer was processed. The `_error.attributes.account`
       will indicate which account, one of `source` or `target`.
       * **`amountOutOfRange`** - The transfer amount was outside the
       account minimum and maximum
       at the time the transfer was processed. The `_error.attributes.minimum`
       and `_error.attributes.maximum` will indicate the allowed range
       (these values are money/currency objects).
       * **`inactiveAccount`** - The source or target account was inactive
       at the time the transfer was processed. The `_error.attributes.account`
       will indicate which account, one of `source` or `target`.
       * **`invalidAccount`** - The source or target account was invalid
       for some other reason at the time the transfer was processed. 
       The `_error.attributes.account` will indicate which account, 
       one of `source` or `target`.
       * **`inactiveUser`** - The user account was inactive
       at the time the transfer was processed.
       * **`missingAccountNumber`** - The account number was missing
       for the source or target account at the time the transfer was processed.
       The `_error.attributes.account` will indicate which account, 
       one of `source` or `target`.
    allOf:
      - $ref: '#/definitions/abstractResource'
      - $ref: '#/definitions/summaryPastTransfer'
      - $ref: '#/definitions/transferAttribution'
      - type: object
        properties:
          confirmationId:
            description: >-
              A unique transaction confirmation ID.
            type: string
            example: 6e5413df-9574-4568-b0c4-dfd96bbb454b
          completedAt:
            description: >-
              The date/time when the transfer was completed.
            type: string
            format: date-time
            example: '2018-05-08T14:08:50.375Z'

  transfer:
    title: Transfer
    description: >-
      **Note**: This model schema is deprecated and only used by
      deprecated operations. See scheduledTransfer instead.
      <p>
      Representation of a transfer resource: a transfer of funds from one
      account to another.
    allOf:
      - $ref: '#/definitions/scheduledTransfer'

  scheduledTransfers:
    title: Scheduled Transfer Collection
    description: >-
      Collection of scheduled transfers. The items in the collection are ordered in the
      `_embedded` object with name `items`. The top-level `_links` object may
      contain pagination links (`self`, `next`, `prev`, `first`, `last`,
      `collection`.)
    allOf:
      - $ref: '#/definitions/collection'
      - type: object
        properties:
          _embedded:
            type: object
            properties:
              items:
                description: An array containing a page of transfer items.
                type: array
                items:
                  $ref: '#/definitions/summaryScheduledTransfer'
    example:
      _profile: 'http://api.apiture.com/schemas/transfers/transfers/v1.0.0/profile.json'
      start: 10
      limit: 10
      count: 67
      name: transfers
      _links:
        self:
          href: /transfers/scheduledTransfers?start=10&limit=10
        first:
          href: /transfers/scheduledTransfers?start=0&limit=10
        next:
          href: /transfers/scheduledTransfers?start=20&limit=10
        collection:
          href: /transfers/scheduledTransfers
      _embedded:
        items:
          - _id: 0399abed-fd3d-4830-a88b-30f38b8a365c
            _profile: 'http://api.apiture.com/schemas/transfers/summaryScheduledTransfer/v1.0.0/profile.json'
            amount:
              value: '345.50'
              currency: USD
            description: Car payment
            state: recurring
            schedule:
              start: '2018-02-05'
              count: 3
              every: P1M
              end: '2021-04-05'
            _links:
              'apiture:source':
                href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
              'apiture:target':
                href: >-
                  /accounts/externalAccounts/599b8ab5-6925-4f58-90c5-f6aa5b05f9d9
              'apiture:transactions':
                href: >-
                  /transaction?transfer=/transfers/transfers/0399abed-fd3d-4830-a88b-30f38b8a365c
              self:
                href: /transfers/scheduledTransfers/0399abed-fd3d-4830-a88b-30f38b8a365c
          - _id: a3bbba3c-d26b-497d-87b7-09eb47b24d77
            _profile: 'http://api.apiture.com/schemas/transfers/summaryScheduledTransfer/v1.0.0/profile.json'
            amount:
              value: '120.0'
              currency: USD
            description: Monthly allowance for Suzy's college expenses and meals
            state: recurring
            schedule:
              start: '2018-08-01'
              count: 24
              every: P1M
              end: '2020-05-15'
            _links:
              'apiture:source':
                href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
              'apiture:target':
                href: >-
                  /accounts/externalAccounts/4fda6275-0a3b-49ad-ad12-5ebcd7013362
              'apiture:transactions':
                href: >-
                  /transaction?transfer=/transfers/transfers/a3bbba3c-d26b-497d-87b7-09eb47b24d77
              self:
                href: /transfers/scheduledTransfers/a3bbba3c-d26b-497d-87b7-09eb47b24d77

  pastTransfers:
    title: Past Transfers Collection
    description: >-
      Collection of past transfers. The items in the collection are ordered in the
      `_embedded` object with name `items`. The top-level `_links` object may
      contain pagination links (`self`, `next`, `prev`, `first`, `last`,
      `collection`.)
    allOf:
      - $ref: '#/definitions/collection'
      - type: object
        properties:
          _embedded:
            type: object
            properties:
              items:
                description: An array containing a page of transfer items.
                type: array
                items:
                  $ref: '#/definitions/summaryPastTransfer'
    example:
      _profile: 'http://api.apiture.com/schemas/transfers/pastTransfers/v1.0.0/profile.json'
      start: 10
      limit: 10
      count: 67
      name: transfers
      _links:
        self:
          href: /transfers/pastTransfers?start=10&limit=10
        first:
          href: /transfers/pastTransfers?start=0&limit=10
        next:
          href: /transfers/pastTransfers?start=20&limit=10
        collection:
          href: /transfers/pastTransfers
      _embedded:
        items:
          - _id: 0399abed-fd3d-4830-a88b-30f38b8a365c
            _profile: 'http://api.apiture.com/schemas/transfers/summaryPastTransfer/v1.0.0/profile.json'
            amount:
              value: '345.50'
              currency: USD
            description: Car payment
            state: recurring
            schedule:
              start: '2018-02-05'
              count: 3
              every: P1M
              end: '2021-04-05'
            _links:
              'apiture:source':
                href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
              'apiture:target':
                href: >-
                  /accounts/externalAccounts/599b8ab5-6925-4f58-90c5-f6aa5b05f9d9
              'apiture:transactions':
                href: >-
                  /transaction?transfer=/transfers/transfers/0399abed-fd3d-4830-a88b-30f38b8a365c
              self:
                href: /transfers/pastTransfers/0399abed-fd3d-4830-a88b-30f38b8a365c
          - _id: a3bbba3c-d26b-497d-87b7-09eb47b24d77
            _profile: 'http://api.apiture.com/schemas/transfers/summaryPastTransfer/v1.0.0/profile.json'
            amount:
              value: '120.0'
              currency: USD
            description: Monthly allowance for Suzy's college expenses and meals
            state: recurring
            schedule:
              start: '2018-08-01'
              count: 24
              every: P1M
              end: '2020-05-15'
            _links:
              'apiture:source':
                href: /accounts/accounts/46a31698-7398-4538-a9c9-9496010da2c2
              'apiture:target':
                href: >-
                  /accounts/externalAccounts/4fda6275-0a3b-49ad-ad12-5ebcd7013362
              'apiture:transactions':
                href: >-
                  /transaction?transfer=/transfers/transfers/a3bbba3c-d26b-497d-87b7-09eb47b24d77
              self:
                href: /transfers/pastTransfers/a3bbba3c-d26b-497d-87b7-09eb47b24d77

  collection:
    title: Collection
    description: >-
      A collection of resources. This is an abstract model schema which is
      extended to define specific resource collections.
    allOf:
      - $ref: '#/definitions/abstractResource'
      - type: object
        properties:
          count:
            description: The number of items in the full collection.
            type: integer
          start:
            description: The start index of this page of items.
            type: integer
          limit:
            description: The maximum number of items per page.
            type: integer
          name:
            description: The name of the collection.
            type: string

  abstractResource:
    title: Abstract Resource
    description: >-
      An augmented [HAL](https://tools.ietf.org/html/draft-kelly-json-hal-08)
      resource representation. This model contains hypermedia `_links`, and
      either optional domain object data with `_profile` and optional
      `_embedded` objects, or an `_error` object. In responses, if the operation
      was successful, this object will not include the `_error`, but if the
      operation was a 4xx or 5xx error, this object will not include `_embedded`
      or any data fields, only `_error` and optionally `_links`.
    example:
      _profile: 'http://api.apiture.com/schema/example/v1.0.0/profile.json'
      _links:
        self:
          href: '{uri of current resource}'
    properties:
      _links:
        $ref: '#/definitions/links'
      _embedded:
        description: >-
          An optional map of nested resources, mapping each nested resource name
          to a nested resource representation.
        type: object
      _profile:
        description: >-
          The URI of a [resource
          profile](http://doc.apiture.com/api/concepts/resource-profile) which
          describes the representation.
        type: string
        format: uri
      _error:
        description: >-
          An object which describes an error. This value is omitted if the
          operation succeeded without error.
        type: object
        allOf:
          - $ref: '#/definitions/error'

  root:
    title: API Root
    description: >-
      A HAL response, with hypermedia `_links` for the top-level resources and
      operations in API.
    example:
      id: apiName
      name: API name
      apiVersion: 0.0.1-SNAPSHOT
      _profile: 'https://api.apiture.com/schema/apiRoot/v1.0.0/profile.json'
      _links: {}
    allOf:
      - $ref: '#/definitions/abstractResource'
      - type: object
        properties:
          _id:
            type: string
            description: This API's unique ID.
          name:
            type: string
            description: This API's name.
          apiVersion:
            type: string
            description: This API's version.

  errorResponse:
    title: Error Response
    description: >-
      Describes an error response, typically returned on 4xx or 5xx errors from
      API operations. The `_error` object contains the error details.
    allOf:
      - $ref: '#/definitions/abstractResource'
    example:
      _profile: 'http://api.apiture.com/schema/error/v1.0.0/profile.json'
      _error:
        _id: 2eae46e1-575c-4d69-8a8f-0a7b0115a4b3
        _profile: 'https://api.apiture.com/schema/error/v1.0.0/profile.json'
        message: The value for deposit must be greater than 0.
        statusCode: 422
        type: positiveNumberRequired
        attributes:
          value: -125.5
        remediation: Provide a value which is greater than 0
        occurredAt: 2018-01-25T05:50:52.375Z
        _links:
          describedby:
            href: 'http://doc.apiture.com/errors/positiveNumberRequired'
        _embedded:
          errors: []

  error:
    title: Error
    description: >-
      An error description. Nested source errors are contained in the
      `_embedded` object with the key `"errors"`; this is an array of nested
      error objects. For example, an API which validates its request body may
      find multiple errors in the request, which may be detailed here. The
      `_links` may contain a `describedby` link which refers to a web page with
      details about the error.
      <p>
      The `attributes` field is an optional map of name/value pairs which provide
      structured data about the error. For example, if the error is a value out
      of range, the attributes may specify the range values `min` and `max`.
      This allows clients to present error messages as they see fit (the API
      does not assume the client/presentation tier).
    required:
      - message
    properties:
      message:
        type: string
        description: A localized message string describing the error condition.
      _id:
        type: string
        description: >-
          A unique identifier for this error instance. This may be used as a
          correlation ID with the root cause error (i.e. this ID may be logged
          at the source of the error). This is is an opaque string.
      statusCode:
        description: The HTTP status code associate with this error.
        type: integer
        minimum: 100
        maximum: 599
        example: 422
      type:
        type: string
        description: >-
          An error identifier which indicates the category of error and
          associate it with API support documentation or which the UI tier can
          use to render an appropriate message or hint. This provides a finer
          level of granularity than the `statusCode`. For example, instead of
          just 400 Bad Request, the `type` may be much more specific. such as
          `integerValueNotInAllowedRange` or `numericValueExceedsMaximum` or
          `stringValueNotInAllowedSet`.
      occurredAt:
        type: string
        format: date-time
        description: An ISO 8601 UTC time stamp indicating when the error occurred.
        example: '2018-02-02T03:37:15.375Z'
      attributes:
        description: >-
          Data attribute associated with the error, such as values or
          constraints.
        allOf:
          - $ref: '#/definitions/attributes'
      remediation:
        type: string
        description: >-
          An optional localized string which provides hints for how the user or
          client can resolve the error.
      _embedded:
        description: >-
          Optional embedded array of errors. This field may not exist if the
          error does not have nested errors.
        type: object
        properties:
          items:
            description: An array of error objects.
            type: array
            items:
              $ref: '#/definitions/errorResponse'
    example:
      _id: 2eae46e1-575c-4d69-8a8f-0a7b0115a4b3
      _profile: 'https://api.apiture.com/schema/error/v1.0.0/profile.json'
      message: The value for deposit must be greater than 0.
      statusCode: 422
      type: positiveNumberRequired
      attributes:
        value: -125.5
      remediation: Provide a value which is greater than 0
      occurredAt: '2018-01-25T05:50:52.375Z'
      _links:
        describedby:
          href: 'http://doc.apiture.com/errors/positiveNumberRequired'
      _embedded:
        errors: []

  attributes:
    title: Attributes
    description: >-
      An optional map of name/value pairs which contains additional dynamic data
      about the resource.
    type: object

  links:
    title: Links
    description: >-
      An optional map of links, mapping each link relation to a link object.
      This model defines the `_links` object of HAL representations.
    type: object
    additionalProperties:
      $ref: '#/definitions/link'

  link:
    title: Link
    description: >-
      Describes a hypermedia link within a `_links` object in HAL
      representations. In Apiture APIs, links are [HAL
      links](https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5), but
      Apiture APIs do not use the `name` or `hreflang` properties of HAL.
      Apiture links _may_ include a `method` property.
    required:
      - href
    properties:
      href:
        type: string
        format: uri
        description: >-
          The URI or URI template for the resource/operation this link refers
          to.
      type:
        type: string
        description: The media type for the resource.
      templated:
        type: boolean
        description: >-
          If true, the link's href is a [URI
          template](https://tools.ietf.org/html/rfc6570).
      title:
        type: string
        description: An optional human-readable localized title for the link.
      deprecation:
        type: string
        format: uri
        description: >-
          If present, the containing link is deprecated and the value is a URI
          which provides human-readable text information about the deprecation.
      profile:
        type: string
        format: uri
        description: >-
          The URI of a profile document, a JSON document which describes the
          target resource/operation.

  schedule:
    title: Schedule
    description: >-
      A definition for a one-time or recurring scheduled transfer.
      Some financial institutions may limit scheduled transfers
      such that the transfer must be within 365 days.
    required:
      - start
    properties:
      start:
        description: >
          When the transaction occurs, or when a recurring transfer begins. This
          may be either a date in `yyyy-mm-dd` format, or a date-time in
          `yyyy-mm-ddTHH:MM:SSZ` format. If present, the time portion is a
          _hint_; the FI may not be able to schedule transfers at specific
          times. If `start` is omitted, the transfer will be scheduled for the next
          processing day. If `start` is the current day, the transfer may
          be scheduled for the next processing day if transfer processing has stopped
          for the day.
        type: string
        example: '2018-06-10'
      every:
        description: >-
          <p>
          The `every` period indicates the interval at which the transfer
          recurs, such as every week, every month, every 3 months.
          If omitted or empty, this transfer is a one-time transfer. 
          `every` is **required** if either `maximumCount` is greater
          than 1 or if `end` is greater than `start`.
          <p>
          This value is an [ISO 8601
          duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) string of
          the form `P[n]Y[n]M[n]D` to specify the number of years/months/days
          between transfers. For example, use `P7D` to transfer every week,
          `P2M` to transfer every other month, `P4Y` to transfer every four
          years on the anniversary set by `start`. Time values in `every` are
          ignored but may be honored in the future. (That is, it is not possible
          to schedule a transfer every 8 hours; the minimum is `P1D`.)
          To specify semi-monthly or semi-annually, use `P0.5M` or `P0.5Y`. 
          Fractional values are only allowed for month and year, and `0.5` 
          is the only allowed fractional value.
          <p>
          Some financial institutions may limit recurring transfers
          such that the period must be a year (`P1Y`, 'P12M`, 'P365D`) or less.
          <p>
          Scheduling may adjust transfer dates if `start` occurs near boundary
          dates which do occur not every year/month, such as `start: "2018-01-31",
          every: "P1M"`. For example, the next transfer may occur on the
          30th for months which have only 30 days (Apr, Jun, Sep, Nov),
          or 29th or 28th for February.
          Actual transfer dates may also be adjusted
          to account for holidays or other days when processing does not occur.
        type: string
        example: P14D
      count:
        description: >-
          For a recurring transfer, this is the number of transfers which
          have been processed. It is a derived value and ignored on updates.
        type: integer
        example: 5
      skippedCount:
        description: >-
          For a recurring transfer, this is the number of transfers which
          have been skipped, either because a processing date passed
          when a recurring transfer had a value of `true` for `skipNext`,
          or a recurring transfer was suspended.
          It is a derived value and ignored on updates.
        type: integer
        example: 0
      maximumCount:
        description: >-
          The maximum number of transfers to perform for a recurring transfer.
          (Transfers in the recurrence will stop if the current date is beyond
          that set by `end, even if fewer than `maximumCount` transfers have
          occurred.) The `every` period is required if `maximumCount` or `end`
          is set. It is an error (422) if `maximumCount` is anything other than
          0 or 1 and `every` is not set. 
          If a schedule contains both `end` and `maximumCount`, the _earliest_ will determine
          when the recurrence ends.
          Otherwise, the Transfers service will compute the other field.
        type: integer
        example: 10
      skipNext:
        description: >-
          This field is *ignored* for one-time transfers. If true for recurring
          schedules, skip (do not process) the next transfer. After that
          instance is skipped, this field is reset to false (only one instance
          may be skipped).
        type: boolean
        example: true
      end:
        description: >-
          The date when the recurring transfer end (inclusive). Transfers will
          occur until the `maximumCount` of transfers have occurred _or_ the
          next scheduled transaction will be _after_ the date or date-time
          specified in `end`. (Earliest of `maximumCount` or `end`
          wins.) 
          If specified, `end` must be no earlier than `start`.
          <p>
          This has the same format as `start` (may be a ISO 8601 date or a
          date-time).
          <p>
          When scheduling a transfer, the request should contain
          either `maximumCount` or `end`, but not both. The Transfers service
          will compute the other field.
        type: string
        example: '2018-08-01'

  money:
    description: An amount of money in a specific currency.
    properties:
      value:
        description: >-
          The net monetary value. A negative amount denotes a debit; a positive
          amount a credit. The numeric value is represented as a string so that
          it can be exact with no loss of precision.
        example: '3456.78'
        type: string
      currency:
        description: >-
          The [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217)
          for this monetary value. This is always upper case ASCII. TODO: ISO
          4217 defines three-character codes. However, ISO 4217 does not account
          for cryptocurrencies. Of note, DASH uses 4 characters.
        type: string
        minLength: 3
        maxLength: 3

x-apiture-errors:
  pastTransferAccessDenied:
    description: The credentials supplied in the request are insufficient to grant access
    remediation: Check the supplied credentials for validity

  scheduledTransferAccessDenied:
    description: The credentials supplied in the request are insufficient to grant access
    remediation: Check the supplied credentials for validity

  invalidAccountId:
    description: No Accounts were found for the specified accountId
    remediation: Check to make sure that the supplied accountId corresponds to an apiture account resource

  sourceAndTargetAccountsAreSame:
    description: Source account and target account are the same account
    remediation: Check to make sure that source account is different from target account

  endDateIsEarlierThanStartDate:
    description: Scheduled transfer end date is earlier than start date
    remediation: Check to make sure that your scheduled end date is later than scheduled start date

  invalidScheduledTransferId:
    description: No scheduledTransfers were found for the specified scheduledTransferId
    remediation: Check to make sure that the supplied scheduledTransferId corresponds to an apiture scheduledTransfer resource

  invalidPastTransferId:
    description: No pastTransfers were found for the specified pastTransferId
    remediation: Check to make sure that the supplied pastTransferId corresponds to an apiture pastTransfer resource

  invalidGroupName:
    description: No configurationGroup was found for the specified groupName
    remediation: Check to make sure that the supplied groupName corresponds to an apiture transfer configuration group resource

  invalidValueName:
    description: No configurationName was found for the specified valueName
    remediation: Check to make sure that the supplied valueName corresponds to an apiture transfer configuration value resource

  invalidConfigurationGroup:
    description: The request body did not conform to the schema for this configuration group
    remediation: Check the schema for the configuration group and resubmit the operation

  invalidConfigurationValue:
    description: The request body did not conform to the schema for this configuration group value
    remediation: Check the schema for the configuration group value and resubmit the operation

  invalidScheduledTransfer:
    description: The request to create a scheduled transfer was not valid
    remediation: Check to make sure the schedule exists and that the start date also exists. Also make sure the start date is a future date or time

  invalidDate:
    description: The start date that was specified in the transfer is not valid
    remediation: Resubmit the operation with a valid start date in the ISO 8601 format
    attributes:
      properties:
        exampleEveryValues: ['2018-09-27', '2018-09-27T18:43:30Z']

  inactiveAccount:
    description: The given account is not currently active
    remediation: Make sure the source and target accounts are active accounts and resubmit the operation

  invalidExternalAccount:
    description: The external account that was specified in transfer request is invalid, as it either does not exist or does not contain links
    remediation: Resubmit the operation with an existing external account that contains links

  externalAccountIsNotVerified:
    description: The external account in the transfer request is not verified.
    remediation: Resubmit the operation with a verified external account in the request

  missingAccountInTransfer:
    description: Either the source, target, or both accounts are missing in the transfer request
    remediation: Resubmit the request with a valid source and target account in the links

  undefinedTransferId:
    description: The transferId that was passed into the update was undefinedTransferIdBadRequest
    remediation: Resubmit the operation with a transferId

  transferCannotBeToAndFromExternal:
    description: A transfer cannot take place between two external accounts
    remediation: Ensure that the source and target accounts in the request are correct, and resubmit with at least one internal account

  malformedAccountUri:
    description: The supplied accountUri was malformed
    remediation: Check to make sure that the supplied accountUri corresponds to an apiture account resource
    attributes:
      properties:
        exampleAccountUris:
          [
            '/accounts/accounts/0399abed-fd3d-4830-a88b-30f38b8a365c',
            '/accounts/externalAccounts/0aba4bae-f18b-4c12-af99-5f8dbd682ae3',
          ]

  malformedTransferUri:
    description: The supplied scheduledTransferUri was malformed
    remediation: Check to make sure that the supplied ScheduledTransferUri corresponds to an apiture transfer resource and the uri is in the correct format
    attributes:
      properties:
        exampleTransferUri: ['/transfers/scheduledTransfers/0399abed-fd3d-4830-a88b-30f38b8a365c']

  malformedRequestBody:
    description: The supplied request body was malformed
    remediation: Check to make sure that your request body exists and that it does not contain syntax errors

  malformedEveryField:
    description: Required field "schedule.every" must conform to the ISO 8601 standard for durations
    remediation: Resubmit the operation with a ISO 8601 valid date
    attributes:
      properties:
        exampleEveryValues: ['2018-09-27', '2018-09-27T18:43:30Z']

  resumeTransferStateInvalidState:
    description: The specified scheduled transfer is in a state that does not allow resuming. Only suspended transfers can be resumed
    remediation: Check the state of the transfer and the applicable allowed state transitions in the Transfers API documentation
    attributes:
      properties:
        requiredStates: ['suspended']

  updateTransferInvalidState:
    description: The specified scheduled transfer is in a state that does not allow this action
    remediation: Check the state of the transfer and the applicable allowed state transitions in the Transfers API documentation

  duplicateTransfer:
    description: The given transfer is a duplicate of a transfer that already exists
    remediation: Check to make sure that the transfer does not already exist. If this is intentional, resubmit with a different transfer description

  ifMatchHeaderMissing:
    description: Precondition Required. The request did not include the required if-Match header
    remediation: Resubmit with the operation, supplying the value of the ETag and the most recent state of the resource

  ifMatchHeaderDoesntMatch:
    description: The supplied `if-Match` header value does not match the most recent `ETag` response header value. The resource has changed in the interim
    remediation: Resubmit the operation, supplying the value of the ETag and the most recent state of the resource

  invalidTransferState:
    description: A transfers state can only be patched if it is in a scheduled, recurring, or suspended state
    remediation: Check the state of the transfer and the applicable allowed state transitions in the Transfers API documentation

  setStatusFailed:
    description: Could not resolve scheduled transfer resource set status
    remediation: Perform a get to make sure the state update did not occur. Resubmit the operation, if it did not

  updateTransferFailed:
    description: A server issue occurred while updating the transfer
    remediation: Perform a get to make sure the update did not occur. Resubmit the operation, if it did not

x-apiture-traits:
  - api:
      links:
        [
          getApi,
          getApiDoc,
          getScheduledTransfers,
          createScheduledTransfer,
          getScheduledTransfer,
          deleteScheduledTransfer,
          patchScheduledTransfer,
          suspendScheduledTransfer,
          resumeScheduledTransfer,
          cancelScheduledTransfer,
          getPastTransfers,
          getPastTransfer,
          getConfigurationGroup,
          getConfigurationGroupSchema,
          getConfigurationGroupValues,
          updateConfigurationGroupValues,
          getConfigurationGroupValue,
        ]
