# Retrieve disputes

`GET /disputes`

> This is a subset of the full specification, limited to the `GET /disputes` operation.
>
> You can find the full specification here: /_bundle/docs/dev-docs/api/index.yaml

```yaml
openapi: 3.1.1
info:
  version: latest
  title: Core APIs
  contact:
    name: Rebilly API Support
    url: https://www.rebilly.com/contact/
    email: integrations@rebilly.com
  license:
    name: Rebilly
    url: https://www.rebilly.com/api-license/
  termsOfService: https://www.rebilly.com/terms-of-use/
  x-logo:
    url: https://rebilly-core.redoc.ly/rb_apiLogo.svg
    backgroundColor: '#0044d4'
  description: This is a subset of the full specification, limited to the `GET /disputes` operation.
  x-metadata:
    description: The most common APIs used to automate common workflows.
    redocly_category: API Reference
servers:
  - url: https://api-sandbox.rebilly.com/organizations/{organizationId}
    description: Sandbox server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  - url: https://api.rebilly.com/organizations/{organizationId}
    description: Live server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
security:
  - SecretApiKey: []
  - JWT: []
tags:
  - name: Disputes
    description: |-
      Use these operations to manage disputes.
      A dispute occurs when a customer contests a charge to their account.
      The dispute and related information is made available to the merchant by the bank or credit card company.
      The merchant then has the option to represent the charge and win the case.
      This process is called dispute resolution.
      If the merchant is unable to represent the charge, the card issuer typically reverses the sale and adds fees on top of the charge.
      This process is called a chargeback.
x-tagGroups:
  - name: Payments
    tags:
      - Disputes
paths:
  /disputes:
    get:
      x-products:
        - Core
      tags:
        - Disputes
      summary: Retrieve disputes
      operationId: GetDisputeCollection
      x-sdk-operation-name: getAll
      description: Retrieves a list of all disputes.
      parameters:
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionSort'
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: List of disputes successfully retrieved.
          headers:
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Dispute'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-codeSamples:
        - lang: PHP
          label: PHP-SDK-2.0
          source: |
            $disputes = $client->disputes()->search([
                'filter' => 'transactionId:testId',
            ]);
        - lang: JavaScript
          source: |
            // all parameters are optional
            const firstCollection = await api.disputes.getAll();

            // alternatively you can specify one or more of them
            const params = {limit: 20, offset: 100, sort: '-createdTime'};
            const secondCollection = await api.disputes.getAll(params);

            // access the collection items, each item is a Dispute
            secondCollection.items.forEach(dispute => console.log(dispute.fields.transactionId));
        - lang: PHP
          source: |-
            $service = new \Rebilly\Sdk\Service($client);

            $disputesPaginator = $service->disputes()->getAllPaginator(filter: 'transactionId:testId', limit: 5);
            foreach ($disputesPaginator as $disputesPage) {
                printf("Disputes page %d/%d\n", $disputesPaginator->key() + 1, $disputesPaginator->count());
                foreach ($disputesPage as $dispute) {
                    printf("Dispute #%s (%s)\n", $dispute->getId(), $dispute->getStatus());
                }
            }

            // OR

            $disputes = $service->disputes()->getAll(filter: 'transactionId:testId');
            foreach ($disputes as $dispute) {
                printf("Dispute #%s (%s)\n", $dispute->getId(), $dispute->getStatus());
            }
components:
  securitySchemes:
    JWT:
      description: |-
        JWT is a short lifetime token that can be assigned a specific expiration time.

        Usage format: `Bearer <JWT>`.
      type: http
      scheme: bearer
      bearerFormat: JWT
    SecretApiKey:
      description: |-
        Never share your secret keys.
        Keep them guarded and secure.

        Use your secret API key only to make requests from the server side.
        To authenticate, provide your secret key in the request header.
      name: REB-APIKEY
      type: apiKey
      in: header
  parameters:
    collectionLimit:
      name: limit
      in: query
      description: |-
        Limit the number of collection items to be returned.
        Use `0` to return an empty collection and still receive the count of matching items in `Pagination-Total`.
      schema:
        type: integer
        minimum: 0
        maximum: 1000
    collectionOffset:
      name: offset
      in: query
      description: Specifies the starting point within the collection of items to be returned.
      schema:
        type: integer
        minimum: 0
        maximum: 1000
    collectionSort:
      name: sort
      in: query
      description: |-
        Sorts and orders the collection of items. To sort in descending
        order, prefix with `-`. Multiple fields can be sorted by separating each with `,`.
      style: form
      explode: false
      schema:
        type: array
        items:
          type: string
    collectionFilter:
      name: filter
      in: query
      description: |-
        Criteria for filtering collection items.
        This field requires a special format.
        Use `,` to specify multiple allowed values.
        Use `;` to specify multiple fields.

        For more information, see [Search filters](https://www.rebilly.com/docs/dev-docs/search-filters).
      schema:
        type: string
    collectionQuery:
      name: q
      in: query
      description: Use this field to perform a partial search of text fields.
      schema:
        type: string
    collectionExpand:
      name: expand
      in: query
      description: |-
        Expands a request to include embedded objects within the `_embedded`
        property of the response. This field accepts a comma-separated list of objects.

        For more information, see
        [Embedded resources](https://www.rebilly.com/docs/dev-docs/expand-embedded-resources).
      schema:
        type: string
  headers:
    Pagination-Total:
      description: |-
        Total number of items that match the request.
        The value is independent of `limit`, including when `limit` is `0`.
      schema:
        type: integer
      example: 332
    Pagination-Limit:
      description: Maximum number of items per page.
      schema:
        type: integer
      example: 100
    Pagination-Offset:
      description: |-
        Specifies the starting point within the
        collection of resource results. For example, a request with
        `limit=20` retrieves and displays the first 20 results on a page. A
        following request with `limit=20` and `offset=20`, retrieves the next
        page of 20 results.
      schema:
        type: integer
      example: 2
  schemas:
    CreatedTime:
      type: string
      description: |-
        Date and time when the resource is created.
        This value is set automatically when the resource is created.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Creation Time
    UpdatedTime:
      type: string
      description: |-
        Date and time when the resource is updated.
        This value is set automatically when the resource is updated.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Last Update Time
    BaseProblem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    Unauthorized:
      allOf:
        - title: Unauthorized
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 401
              maximum: 401
        - $ref: '#/components/schemas/BaseProblem'
    OrganizationId:
      type: string
      description: |-
        Unique organization identifier.
        An organization is an entity that represents a company.
        For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
      maxLength: 50
      example: org_0YVDM8RC7GDADADSBSMW124JA8
    Forbidden:
      allOf:
        - title: Forbidden
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 403
              maximum: 403
            error:
              type: string
              description: |-
                Message that describes why the request is forbidden.
                Most responses use a descriptive message, such as `Not allowed to change security settings`.
                If the organization requires multi-factor authentication (MFA) and MFA verification has not been completed for the session, this value is `mfa_required`.
                If MFA verification has not been completed for the session and the operation requires a confirmed session, this value is `mfa_required_for_caller`.
                This includes turning on `requireMfa` and resetting MFA for a user.
                If the organization restricts access to a list of IP addresses and the request comes from an IP address that is not in the list, this value is `ip_not_allowed`.
            organizationId:
              description: |-
                ID of the organization that requires MFA or does not allow the IP address of the request.
                This property is present only if `error` is `mfa_required` or `ip_not_allowed`.
                The organization is the organization of the request or another organization that the request acts on.
              $ref: '#/components/schemas/OrganizationId'
        - $ref: '#/components/schemas/BaseProblem'
    CurrencyCode:
      type: string
      description: Currency code in ISO 4217 format.
      minLength: 3
      maxLength: 3
      example: USD
      x-label: Currency
    Dispute:
      type: object
      properties:
        id:
          type: string
          description: ID of the dispute.
          readOnly: true
          maxLength: 50
          example: dp_0YVCE8J5F2DE58FV0S8YASW4HK
        customerId:
          description: ID of the customer who is disputing a transaction.
          type:
            - string
            - 'null'
          readOnly: true
          maxLength: 50
          example: cus_0YV7DDSDD1C8DA64KHH2W33CPF
        transactionId:
          description: ID of the disputed transaction.
          type:
            - string
            - 'null'
          maxLength: 50
          example: txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: Dispute amount.
          type: number
          format: double
        acquirerReferenceNumber:
          description: Acquirer reference number for the dispute.
          type:
            - string
            - 'null'
        caseId:
          description: Case ID of the dispute.
          type:
            - string
            - 'null'
        reasonCode:
          description: Code used in the chargeback that describes the reason for the dispute.
          type:
            - string
            - 'null'
          maxLength: 255
        reasonDescription:
          description: Description of the reason for the dispute.
          type:
            - string
            - 'null'
          maxLength: 512
          readOnly: true
        category:
          description: Category of dispute.
          type: string
          readOnly: true
          enum:
            - fraud
            - authorization
            - processing-errors
            - consumer-disputes
            - uncategorized
            - bank-return
        type:
          description: Type of dispute.
          type: string
          enum:
            - information-request
            - first-chargeback
            - second-chargeback
            - arbitration
            - fraud
            - ethoca-alert
            - verifi-alert
            - bank-return
            - paypal-claim
            - representment
            - inquiry
            - forced-refund
            - collaboration
        status:
          description: Status of the dispute.
          type: string
          enum:
            - response-needed
            - under-review
            - forfeited
            - won
            - lost
            - unknown
        postedTime:
          description: Date and time when the dispute is posted.
          type: string
          format: date-time
        deadlineTime:
          description: |-
            Latest date and time by when a merchant must submit a representment for a dispute.
            If the deadline is missed, the merchant loses the dispute.
          type:
            - string
            - 'null'
          format: date-time
        rawResponse:
          description: Raw response from the payment gateway that processed the disputed transaction.
          type:
            - string
            - 'null'
          readOnly: true
        resolvedTime:
          type:
            - string
            - 'null'
          format: date-time
          description: Date and time when the dispute is resolved.
          readOnly: true
        source:
          description: Source of the dispute.
          type:
            - string
            - 'null'
          readOnly: true
          enum:
            - null
            - api
            - manual
            - sftp
            - webhook
        revision:
          description: |-
            Number of times the dispute data has been modified.

            Use the revision number when analyzing webhook data to
            determine if a change should take precedence over the current
            representation.
          type: integer
          readOnly: true
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          type: array
          description: Related links.
          readOnly: true
          items:
            type: object
            properties:
              href:
                description: Link URL.
                type: string
              rel:
                description: Type of link.
                type: string
                enum:
                  - self
                  - transaction
                  - customer
                  - attachments
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            transaction:
              type: object
            customer:
              type: object
  responses:
    Unauthorized:
      description: |-
        Unauthorized access.
        Invalid credentials used.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    Forbidden:
      description: |-
        Access forbidden.
        If the organization requires multi-factor authentication (MFA) and the session has not passed MFA, `error` is `mfa_required`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
```
