Dispute defense

When a payer opens a dispute (MED) on one of your transactions, the transaction moves to DISPUTE_NEEDS_RESPONSE and you receive a dispute webhook. The endpoints on this page let you build your defense for that transaction: the customer data, the order, the customer's activity on your platform, and the files that prove it.

The defense stays inside the Hub. Nothing on this page is sent to the provider automatically. After you submit, the Hub team reviews the defense, generates the report and forwards it to the provider.

How it works

  1. Fill in the defense with PUT /api/disputes/{magic_id}/defense. You can save it as many times as you want: each call updates only the fields you send.
  2. Upload the evidence files with POST /api/disputes/{magic_id}/defense/attachments.
  3. Submit it with POST /api/disputes/{magic_id}/defense/submit. After that you can no longer edit it.

{magic_id} is the magic_id of the disputed transaction, the same one returned by POST /api/transactions.

Defense statuses

  • Name
    DRAFT
    Type
    status
    Description

    You are still filling it in. Only drafts can be edited by you.

  • Name
    SUBMITTED
    Type
    status
    Description

    You submitted it and the Hub team is reviewing it. If something is missing, it is sent back to DRAFT with a comment in reopen_comment.

  • Name
    SENT_TO_PROVIDER
    Type
    status
    Description

    The report was forwarded to the provider.

You can edit and submit only while the transaction is DISPUTE_NEEDS_RESPONSE or DISPUTE_IN_REVIEW. When the provider sends a deadline, it is returned in charge.defense_deadline. Submit before it.

Required to submit

  • product_type
  • customer_document, a valid CPF or CNPJ
  • at least one attachment, or at least one entry in access_logs

GET/api/disputes/{magic_id}/defense

Retrieve the defense

Returns the disputed transaction, the defense (null if you haven't saved one yet), the attachments and what you can do next.

/api/disputes/{magic_id}/defense

Authorizations

  • Name
    x-api-key
    Type
    string (header)
    Description

    Required Project API key sent in x-api-key header.

  • Name
    x-token
    Type
    string (header)
    Description

    Required Session token sent in x-token header.

Response content

  • Name
    charge
    Type
    object
    Description

    The disputed transaction: magic_id, status, amount, end_to_end, external_ref, paid_at, dispute_reason, dispute_on and defense_deadline.

  • Name
    payer
    Type
    object
    Description

    The payer used in the report (name, document, bank) and its source: PROVIDER (sent by the provider), ADMIN (taken from the provider statement by the Hub team), MERCHANT_DEFENSE (your customer_document) or NONE.

  • Name
    history
    Type
    object
    Description

    Other Pix payments from the same payer document (payments) and your withdrawals to a Pix key with that document (payouts). available is false when no payer document is known yet. In that case, the empty lists don't mean there are no other payments.

  • Name
    defense
    Type
    object | null
    Description

    The defense fields (see the body of the PUT below), plus magic_id, status, reopen_comment, submitted_at, sent_at and updated_at.

  • Name
    attachments
    Type
    array
    Description

    Files you uploaded: magic_id, kind, filename, description, content_type, size_bytes, sha256, created_at.

  • Name
    permissions
    Type
    object
    Description

    can_edit, can_submit and deadline_passed.

Request

GET
/api/disputes/{magic_id}/defense
curl --request GET \
  --url https://my.domain.io/api/disputes/<magic_id>/defense \
  --header 'x-api-key: <api-key>' \
  --header 'x-token: <api-key>'

Response

{
  "code": 200,
  "content": {
    "charge": {
      "magic_id": "cmh1x2y3z0001abcd",
      "status": "DISPUTE_NEEDS_RESPONSE",
      "amount": 150.0,
      "currency": "BRL",
      "end_to_end": "E1234567820261101120000abcdefghij",
      "external_ref": "order-9876",
      "paid_at": "2026-11-01T12:00:05Z",
      "dispute_reason": "fraud",
      "dispute_on": "2026-11-02T09:00:00Z",
      "defense_deadline": "2026-11-09T09:00:00Z"
    },
    "payer": {
      "name": null,
      "document": null,
      "bank": null,
      "source": "NONE"
    },
    "history": { "available": false, "payments": [], "payouts": [] },
    "defense": null,
    "attachments": [],
    "permissions": {
      "can_edit": true,
      "can_submit": false,
      "deadline_passed": false
    }
  },
  "message": "Defesa",
  "timestamp": "2026-11-02T10:00:00Z"
}

PUT/api/disputes/{magic_id}/defense

Save the defense

Creates or updates the draft. Send only the fields you want to change. A field you leave out keeps its value, and an empty string clears it. Unknown fields are rejected. Returns the same content as the GET.

/api/disputes/{magic_id}/defense

Body

  • Name
    product_type
    Type
    string
    Description

    What was sold (product, service, deposit, etc.). Required to submit.

  • Name
    product_description
    Type
    string
    Description

    Details of what was sold.

  • Name
    customer_name
    Type
    string
    Description

    Your customer's name, as registered on your platform.

  • Name
    customer_document
    Type
    string
    Description

    Your customer's CPF or CNPJ, with or without mask. Must be valid. Required to submit.

  • Name
    customer_email
    Type
    string
    Description

    Your customer's e-mail.

  • Name
    customer_phone
    Type
    string
    Description

    Your customer's phone.

  • Name
    order_id
    Type
    string
    Description

    Order id on your platform.

  • Name
    order_at
    Type
    string (ISO 8601)
    Description

    When the order was placed.

  • Name
    delivery_proof
    Type
    string
    Description

    How and when the product or service was delivered.

  • Name
    merchant_segment
    Type
    string
    Description

    Your business segment.

  • Name
    customer_balance
    Type
    number
    Description

    Customer's current balance on your platform. Can't be negative.

  • Name
    customer_loss
    Type
    number
    Description

    Total the customer lost on your platform (for example, in bets). Can't be negative.

  • Name
    customer_withdrawn
    Type
    number
    Description

    Total the customer withdrew from your platform. Can't be negative.

  • Name
    customer_movements
    Type
    array
    Description

    Up to 500 movements of the customer on your platform. Each one has type (required, e.g. DEPOSIT, WITHDRAWAL, PURCHASE, BET, PRIZE, OTHER), amount (required), occurred_at, reference and description. Sending the list replaces the previous one.

  • Name
    access_logs
    Type
    array
    Description

    Up to 500 accesses of the customer to your platform. Each one has ip (required, valid IPv4 or IPv6), occurred_at, user_agent and device_id. Sending the list replaces the previous one.

  • Name
    narrative
    Type
    string
    Description

    Your explanation of the case, in your own words. Up to 20,000 characters, like every text field.

Request

PUT
/api/disputes/{magic_id}/defense
curl --request PUT \
  --url https://my.domain.io/api/disputes/<magic_id>/defense \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --header 'x-token: <api-key>' \
  --data '
{
  "product_type": "Digital service",
  "customer_name": "Maria Silva",
  "customer_document": "52998224725",
  "order_id": "order-9876",
  "order_at": "2026-11-01T11:58:00Z",
  "customer_movements": [
    { "type": "DEPOSIT", "amount": 150.00, "occurred_at": "2026-11-01T12:00:05Z" }
  ],
  "access_logs": [
    { "occurred_at": "2026-11-01T11:57:00Z", "ip": "203.0.113.10" }
  ]
}
'

POST/api/disputes/{magic_id}/defense/attachments

Upload an attachment

Uploads one evidence file as multipart/form-data. The file type is detected from its content, not from its extension. Uploading the same file twice keeps a single copy. Returns the same content as the GET.

Limits: PDF, PNG, JPG or CSV; up to 10 MB per file, 20 files and 50 MB per defense.

Form fields

  • Name
    file
    Type
    file
    Description

    Required The file.

  • Name
    kind
    Type
    enum
    Description

    Required What the file proves: ORDER_SCREEN, DELIVERY_PROOF, MOVEMENTS, ACCESS_LOG, CUSTOMER_KYC or OTHER.

  • Name
    description
    Type
    string
    Description

    Short description of the file.

Other attachment endpoints

  • GET /api/disputes/{magic_id}/defense/attachments/{attachment_magic_id} downloads a file.
  • DELETE /api/disputes/{magic_id}/defense/attachments/{attachment_magic_id} removes it, while the defense is a draft.

Request

POST
/api/disputes/{magic_id}/defense/attachments
curl --request POST \
  --url https://my.domain.io/api/disputes/<magic_id>/defense/attachments \
  --header 'x-api-key: <api-key>' \
  --header 'x-token: <api-key>' \
  --form 'kind=ORDER_SCREEN' \
  --form 'description=Checkout screen with customer data' \
  --form 'file=@order-9876.png'

POST/api/disputes/{magic_id}/defense/submit

Submit the defense

Sends the draft to the Hub team for review. The status changes to SUBMITTED and you can no longer edit it. Returns the same content as the GET.

/api/disputes/{magic_id}/defense/submit

Errors

  • Name
    400
    Type
    error
    Description

    Something required is missing. The message lists what.

  • Name
    404
    Type
    error
    Description

    The transaction doesn't exist, isn't yours, or isn't disputed.

  • Name
    409
    Type
    error
    Description

    The defense was already submitted, the dispute is closed, or the deadline passed.

Request

POST
/api/disputes/{magic_id}/defense/submit
curl --request POST \
  --url https://my.domain.io/api/disputes/<magic_id>/defense/submit \
  --header 'x-api-key: <api-key>' \
  --header 'x-token: <api-key>'

Was this page helpful?