Portal
Raise an Invoice Dispute
Raise a dispute or query on one of the logged-in customer’s own invoices
POST
/
portal
/
api
/
invoices
/
{id}
/
dispute
Raise a dispute/query on one of the customer's own invoices
curl --request POST \
--url https://billing.example.com/portal/api/invoices/{id}/dispute \
--header 'Content-Type: application/json' \
--cookie portal_session= \
--data '
{
"reason": "I was charged twice for this invoice."
}
'import requests
url = "https://billing.example.com/portal/api/invoices/{id}/dispute"
payload = { "reason": "I was charged twice for this invoice." }
headers = {
"cookie": "portal_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'portal_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'I was charged twice for this invoice.'})
};
fetch('https://billing.example.com/portal/api/invoices/{id}/dispute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/portal/api/invoices/{id}/dispute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'I was charged twice for this invoice.'
]),
CURLOPT_COOKIE => "portal_session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/portal/api/invoices/{id}/dispute"
payload := strings.NewReader("{\n \"reason\": \"I was charged twice for this invoice.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "portal_session=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/portal/api/invoices/{id}/dispute")
.header("cookie", "portal_session=")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"I was charged twice for this invoice.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/portal/api/invoices/{id}/dispute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'portal_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"I was charged twice for this invoice.\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reason": "<string>",
"status": "open",
"note": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"resolved_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Portal endpoints authenticate via the
portal_session cookie issued by magic-link verification — not a Bearer API key. State-changing portal calls must additionally echo the portal_csrf cookie’s value in the X-CSRF-Token header (double-submit CSRF).404 is returned (existence is not leaked). At most one open dispute exists per invoice: re-raising updates the reason of the existing open dispute.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | Yes | The invoice ID. Must belong to the authenticated customer. |
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
reason | string | Yes | Why the customer is disputing the invoice. |
Example Request
curl -X POST "https://api.recurso.dev/portal/api/invoices/3c9e1f57-2b8a-4d6c-9f0e-5a7b3d1c8e42/dispute" \
-b "portal_session=$PORTAL_SESSION; portal_csrf=$CSRF_TOKEN" \
-H "X-CSRF-Token: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"reason": "I was charged twice for this invoice."
}'
Response
{
"data": {
"id": "8e4b2d17-5a9c-4f3e-b6d0-1c7a4e9f2b58",
"tenant_id": "f2a8c4e6-9b1d-4a3c-8e5f-7d0b2c4a6e91",
"invoice_id": "3c9e1f57-2b8a-4d6c-9f0e-5a7b3d1c8e42",
"customer_id": "9f2c1e84-6a3d-4b7e-9c21-8f4a5d6e7b01",
"reason": "I was charged twice for this invoice.",
"status": "open",
"note": null,
"created_at": "2026-08-12T09:15:00Z",
"resolved_at": null
}
}
Authorizations
Customer-portal session cookie issued by GET /portal/auth/verify.
Path Parameters
Invoice ID.
Body
application/json
Example:
"I was charged twice for this invoice."
Response
The open dispute.
A customer-raised dispute/query against one of their invoices.
Show child attributes
Show child attributes
⌘I
Raise a dispute/query on one of the customer's own invoices
curl --request POST \
--url https://billing.example.com/portal/api/invoices/{id}/dispute \
--header 'Content-Type: application/json' \
--cookie portal_session= \
--data '
{
"reason": "I was charged twice for this invoice."
}
'import requests
url = "https://billing.example.com/portal/api/invoices/{id}/dispute"
payload = { "reason": "I was charged twice for this invoice." }
headers = {
"cookie": "portal_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'portal_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'I was charged twice for this invoice.'})
};
fetch('https://billing.example.com/portal/api/invoices/{id}/dispute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/portal/api/invoices/{id}/dispute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'I was charged twice for this invoice.'
]),
CURLOPT_COOKIE => "portal_session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/portal/api/invoices/{id}/dispute"
payload := strings.NewReader("{\n \"reason\": \"I was charged twice for this invoice.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "portal_session=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/portal/api/invoices/{id}/dispute")
.header("cookie", "portal_session=")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"I was charged twice for this invoice.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/portal/api/invoices/{id}/dispute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'portal_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"I was charged twice for this invoice.\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reason": "<string>",
"status": "open",
"note": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"resolved_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}