openapi: 3.0.0
info:
  title: Audit API
  contact:
    name: API Integration Support
    email: integration@dintero.com
  description: |
    # Changelog

    All notable changes to the API.

    ## 2019-01-31

    > Add support for getting request audit log
    > - [GET /v1/v1/accounts/{aid}/audit/logs](/audit-api/request-audit/aid_audit_logs_get)
  version: LATEST
  license:
    name: UNLICENSED
    url: https://dintero.com
  x-logo:
    url: https://docs.dintero.com/img/dintero-dark-padded.svg
    altText: Dintero Logo
security:
  - JWT: []
tags:
  - name: request-audit
    description: View audit logs for requests
    x-displayName: API Requests
paths:
  /v1/accounts/{aid}/audit/logs:
    get:
      operationId: aid_audit_logs_get
      summary: aid_audit_logs_get
      description: |
        **scopes**:
          - read:audit
      x-scopes:
        - read:audit
      security:
        - JWT: []
      tags:
        - request-audit
      parameters:
        - $ref: '#/components/parameters/accountId'
        - name: entity_id
          in: query
          description: |
            Id of the entity in the domain.

            Can not be used with `api_operation_id` or `response.status`
          example: checkout/T11223351.55ATvtzANP27uN6z2sHN6K
          schema:
            type: string
        - name: api_operation_id
          in: query
          description: |
            Filter on api operation id

            Can not be used with `entity_id` or `response.status`
          example: checkout_callback
          schema:
            type: string
        - name: response.status
          in: query
          description: |
            Limit request log on HTTP status code

            Can not be used with `entity_id` or `api_operation_id`
          example: 401
          schema:
            type: number
        - $ref: '#/components/parameters/startingAfter'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          $ref: '#/components/responses/AuditRequestLog'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Get Audit Request Log
          sidebarTitle: Get Audit Request Log
x-tagGroups:
  - name: Audit
    tags:
      - request-audit
servers:
  - url: https://api.dintero.com
components:
  parameters:
    accountId:
      name: aid
      description: |
        An id that uniquely identifies the account.
      in: path
      required: true
      schema:
        type: string
        format: ^[PT]{1}\d{8}$
        minLength: 9
        maxLength: 9
    startingAfter:
      name: starting_after
      in: query
      description: |
        cursor for use in pagination. starting_after is an object ID
        that defines your place in the list. For instance, if you make
        a list request and receive 100 objects, end the result contains
          `paging_token=pt1`, your subsequent call can include
        `starting_after=pt1` in order to fetch the next page of the list.
      required: false
      schema:
        type: string
    limit:
      name: limit
      in: query
      description: |
        A limit on the number of objects to be returned. Limit can range
        between 1 and 100 items, and the default is 10 items.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 10
  responses:
    AuditRequestLog:
      description: Audit Request Log
      content:
        application/json:
          schema:
            type: object
            properties:
              items:
                type: array
                items:
                  $ref: '#/components/schemas/RequestLog'
              starting_after:
                type: string
                description: cursor for use in pagination
    BadRequest:
      description: Bad / Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    JWT:
      type: http
      description: |
        Bearer authentication (token authentication) should be used for accessing the API.

        Use [Get Token](/api-reference/authenticate/aid_auths_oauth_token_post) to get an access token for client credentials.
        Pass the token in the request header:

            Authorization: Bearer {access_token}

        where the **access_token** is JSON Web Tokens (JWT).
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Headers:
      type: object
      properties:
        referer:
          type: string
          example: https://backoffice.dintero.com/P00000000/customers
        user-agent:
          type: string
          example: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)
        content-type:
          type: string
          example: application/json
        content-length:
          type: string
          example: '91'
        accept:
          type: string
          example: application/json
        version:
          type: string
          example: commit-e443ff41
        x-amzn-trace-id:
          type: string
          example: Root=1-5a94fa4a-abcfb82fcc63c99b31a7ecf8
    RequestLog:
      type: object
      properties:
        id:
          type: string
        success:
          type: boolean
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
        response_time:
          type: number
          description: |
            Time in ms that the request took to complete
        api_operation_id:
          type: string
          example: post_session_profile
        entity_id:
          type: string
          example: checkout/T11223351.55ATvtzANP27uN6z2sHN6K
        request_id:
          type: string
          example: 99e9c0a0-2494-4864-8cfa-0deefe986c09
        request:
          type: object
          required:
            - url
            - method
            - headers
          properties:
            url:
              type: string
              example: /v1/accounts/T00000000/customers/users
            user:
              type: object
              properties:
                id:
                  type: string
                  example: ec2ad7c7-78a0-4434-bd3d-afdab3c507fb
            method:
              type: string
              example: GET
              enum:
                - OPTIONS
                - GET
                - HEAD
                - POST
                - PUT
                - DELETE
            body:
              type: object
              example: null
              nullable: true
            headers:
              $ref: '#/components/schemas/Headers'
        response:
          type: object
          required:
            - status
          properties:
            status:
              type: number
              example: 200
            headers:
              $ref: '#/components/schemas/Headers'
            body:
              type: object
              example: []
              nullable: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
