> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Add response to dispute

POST https://api-sandbox.payabli.com/api/ChargeBacks/response/{Id}
Content-Type: application/json

Add a response to a chargeback or ACH return.

Reference: https://docs.payabli.com/developers/api-reference/chargebacks/add-response-to-chargeback-or-return

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi-oas
  version: 1.0.0
paths:
  /ChargeBacks/response/{Id}:
    post:
      operationId: AddResponse
      summary: Add response to chargeback or return
      description: Add a response to a chargeback or ACH return.
      tags:
        - chargeBacks
      parameters:
        - name: Id
          in: path
          description: ID of the chargeback or return record.
          required: true
          schema:
            type: integer
            format: int64
        - name: requestToken
          in: header
          description: >
            Long-lived API token sent in the `requestToken` header. See [API
            token authentication](/developers/api-tokens).
          required: true
          schema:
            type: string
        - name: idempotencyKey
          in: header
          description: >-
            _Optional but recommended_ A unique ID that you can include to
            prevent duplicating objects or transactions in the case that a
            request is sent more than once. This key isn't generated in Payabli,
            you must generate it yourself. This key persists for 2 minutes.
            After 2 minutes, you can reuse the key if needed.
          required: false
          schema:
            $ref: '#/components/schemas/IdempotencyKey'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddResponseResponse'
        '400':
          description: Bad request / invalid data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '503':
          description: Database connection error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponseChargeBack'
servers:
  - url: https://api-sandbox.payabli.com/api
    description: Sandbox
  - url: https://api.payabli.com/api
    description: Production
components:
  schemas:
    IdempotencyKey:
      type: string
      description: >
        _Optional but recommended._ A unique ID that you can include to prevent

        duplicating objects or transactions in the case that a request is sent

        more than once. This key isn't generated in Payabli; you must generate
        it

        yourself. The key persists for 2 minutes. After 2 minutes, you can reuse

        the key if needed.
      title: IdempotencyKey
    FileContentFtype:
      type: string
      enum:
        - pdf
        - doc
        - docx
        - jpg
        - jpeg
        - png
        - gif
        - txt
      description: The MIME type of the file (if content is provided).
      title: FileContentFtype
    FileContent:
      type: object
      properties:
        fContent:
          type: string
          description: |
            Content of file, Base64-encoded. Ignored if `furl` is specified. Max
            upload size is 30 MB.
        filename:
          type: string
          description: The name of the attached file.
        ftype:
          $ref: '#/components/schemas/FileContentFtype'
        furl:
          type: string
          description: Optional URL provided to show or download the file remotely.
      description: Contains details about a file. Max upload size is 30 MB.
      title: FileContent
    Attachments:
      type: array
      items:
        $ref: '#/components/schemas/FileContent'
      description: >
        Array of `fileContent` objects with attached documents. Max upload size
        is

        30 MB.
      title: Attachments
    Email:
      type: string
      format: email
      description: Email address.
      title: Email
    ResponseChargeBack:
      type: object
      properties:
        attachments:
          $ref: '#/components/schemas/Attachments'
          description: Array of attached files to response.
        contactEmail:
          $ref: '#/components/schemas/Email'
          description: Email of response submitter.
        contactName:
          type: string
          description: Name of response submitter
        notes:
          type: string
          description: Response notes
      title: ResponseChargeBack
    IsSuccess:
      type: boolean
      description: |
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    ResponseText:
      type: string
      description: |
        Response text for operation: 'Success' or 'Declined'.
      title: ResponseText
    AddResponseResponse:
      type: object
      properties:
        isSuccess:
          $ref: '#/components/schemas/IsSuccess'
        responseText:
          $ref: '#/components/schemas/ResponseText'
        responseData:
          type: integer
          description: |
            If `isSuccess` = true, this contains the chargeback identifier. If
            `isSuccess` = false, this contains the reason for the error.
      required:
        - responseText
      description: >
        Minimal response wrapper used by approval-style endpoints that don't
        carry

        the standard response envelope.
      title: AddResponseResponse
    PayabliErrorBodyResponseData:
      type: object
      properties:
        explanation:
          type: string
          description: Human-readable explanation of what happened.
        todoAction:
          type: string
          description: Suggested resolution.
      description: Object with detailed error context.
      title: PayabliErrorBodyResponseData
    PayabliErrorBody:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: Always `false` for error responses.
        responseCode:
          type: integer
          description: |
            Code for the response. Learn more in
            [API Response Codes](/developers/api-reference/api-responses).
        responseText:
          type: string
          description: Error text describing what went wrong.
        responseData:
          $ref: '#/components/schemas/PayabliErrorBodyResponseData'
          description: Object with detailed error context.
      required:
        - isSuccess
        - responseText
      description: |
        Shape returned by every Payabli API error response. The `responseData`
        object carries human-readable error context.
      title: PayabliErrorBody
  securitySchemes:
    APIKeyAuth:
      type: apiKey
      in: header
      name: requestToken
      description: >
        Long-lived API token sent in the `requestToken` header. See [API token
        authentication](/developers/api-tokens).
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        OAuth2 Bearer access token from the client-credentials flow. See [OAuth
        authentication](/developers/oauth-authentication).

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "responseData": 126
}
```

**SDK Code**

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.chargeBacks.addResponse(1000000, {
        idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA",
    });
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.charge_backs.add_response(
    id=1000000,
    idempotency_key="6B29FC40-CA47-1067-B31D-00DD010662DA",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.resources.chargebacks.requests.ResponseChargeBack;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.chargeBacks().addResponse(
            1000000L,
            ResponseChargeBack
                .builder()
                .idempotencyKey("6B29FC40-CA47-1067-B31D-00DD010662DA")
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.charge_backs.add_response(
  id: 1000000,
  idempotency_key: "6B29FC40-CA47-1067-B31D-00DD010662DA"
)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.ChargeBacks.AddResponseAsync(
            1000000L,
            new ResponseChargeBack {
                IdempotencyKey = "6B29FC40-CA47-1067-B31D-00DD010662DA"
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.ResponseChargeBack{
        IdempotencyKey: payabli.String(
            "6B29FC40-CA47-1067-B31D-00DD010662DA",
        ),
    }
    client.ChargeBacks.AddResponse(
        context.TODO(),
        int64(1000000),
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\ChargeBacks\Requests\ResponseChargeBack;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->chargeBacks->addResponse(
    1000000,
    new ResponseChargeBack([
        'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA',
    ]),
);

```

```swift
import Foundation

let headers = [
  "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/ChargeBacks/response/1000000")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```