> This page is for Internet banking (beta).

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://en.docs.api.corpx.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://en.docs.api.corpx.com/_mcp/server.

# Update an ad

PATCH https://client.api.corpx.com/v1/accounts/{accountId}/p2p/ads/{adId}
Content-Type: application/json

Changes price, limits, stock, wallet or status. `closed` is final. Stock cannot go below what open orders reserve. Reactivating a buy ad while the account's cashout is blocked is `423 cashout_locked`.


Reference: https://en.docs.api.corpx.com/ib/referencia/p-2-p/update-p-2-p-ad

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `accountId` (string, required) — Account identifier.
- `adId` (string, required) — P2P ad identifier.

### Headers

- `X-Tenant-Id` (string, required) — Tenant context used for authorization and routing.
- `X-Acting-Document` (string, optional) — CPF of the human performing the operation. Required on cashout routes when the credential enforces a transaction PIN. On a company P2P profile contact, this CPF is the holder who signs; it is not taken from the body.
- `Idempotency-Key` (string, optional) — Optional client-generated idempotency token (recommended for safe retries).
- `X-Request-Timestamp` (string, required) — Unix seconds. Required on the signed host; tolerance is 300s either way (`403 request_timestamp_skew`).
- `X-Content-SHA256` (string, required) — Lowercase hex SHA-256 of the body. An empty body hashes the empty string, so the header is always present. Mismatch returns `400 body_hash_mismatch`.
- `X-Request-Signature` (string, required) — Detached JWS (`<protected>..<signature>`, ES256 or PS256) over `METHOD\nPATH?QUERY\nTIMESTAMP\nIDEMPOTENCY_KEY_OR_EMPTY\nX_CONTENT_SHA256`.

### Body (application/json)

This endpoint expects an object.

- `side` (enum, optional) — `sell`: you sell crypto for BRL. Required on creation.
  - Allowed values: `sell`, `buy`
- `pair` (string, optional) — Required on creation.
- `priceMode` (enum, optional) — `spread`: basis points over the Binance spot. `fixed`: fixed BRL price. `offset`: a signed BRL amount (4 decimal places) added to the Binance spot. The unit price always has 4 decimal places; the order amount rounds down to cents at opening and the fee rounds up. The fee rate stays in basis points of the order amount, whatever the mode.
  - Allowed values: `spread`, `fixed`, `offset`
- `spreadBps` (integer, optional) — `spread` mode: spread over the Binance spot price at the moment. The listed price is indicative; the order locks the spread over the spot captured at opening.
- `fixedPrice` (string, optional) — `fixed` mode: fixed BRL price per unit, up to 4 decimal places. The order locks this price as-is; only the BRL amount rounds to cents at opening.
- `offset` (string, optional) — `offset` mode: signed BRL amount per unit added to the Binance spot, up to 4 decimal places (`-0.0100` buys one cent below, `0.0001` is one ten-thousandth). Must stay within 5% of the current spot (`422 invalid_offset`); without a Binance quote when publishing or changing the offset, `409 price_unavailable`.
- `stockAmount` (string, optional) — Crypto amount offered (sell) or wanted (buy).
- `limitsUnit` (enum, optional) — Unit of the per-order range. `brl` (default): `minAmount`/`maxAmount` in BRL. `asset`: `minAssetAmount`/`maxAssetAmount` in crypto, and the opening compares the order crypto amount against them. Sending the fields of the other unit is `400 invalid_payload`; switching units requires both bounds in the new unit (`400 missing_fields`). With `asset`, a Binance quote is needed when the range or the price changes (`409 price_unavailable`), because the BRL equivalent is what the per-order cap and the buy-ad autopause measure.
  - Allowed values: `brl`, `asset`
- `minAmount` (string, optional) — Minimum BRL per order (`limitsUnit` `brl`).
- `maxAmount` (string, optional) — Maximum BRL per order (capped by tenant and advertiser caps; `limitsUnit` `brl`).
- `minAssetAmount` (string, optional) — Minimum crypto per order, up to the pair decimals (`limitsUnit` `asset`).
- `maxAssetAmount` (string, optional) — Maximum crypto per order (`limitsUnit` `asset`). Its BRL equivalent is still capped by tenant and advertiser caps.
- `deliveryDeadlineMin` (integer, optional) — Minutes the seller has to send after both sign.
- `instructions` (string, optional)
- `walletId` (string, optional) — Approved wallet: source (sell) or destination (buy).
- `status` (enum, optional) — PATCH only.
  - Allowed values: `active`, `paused`, `closed`
- `offsetCents` (integer, optional, deprecated) — Deprecated. Whole BRL cents; `1` is stored as `0.0100`. Prefer `offset`. Ignored when `offset` is also sent.

## Response

### 200

Ad

- `adId` (string, optional) — Ad identifier.
- `side` (enum, optional) — Advertiser side.
  - Allowed values: `sell`, `buy`
- `pair` (string, optional) — Pair code.
- `priceMode` (enum, optional) — Pricing: `spread` (bps over the Binance spot), `fixed` (fixed BRL price) or `offset` (signed BRL amount, 4 decimal places, over the Binance spot).
  - Allowed values: `spread`, `fixed`, `offset`
- `spreadBps` (integer, optional) — `spread` mode: basis points over the Binance spot.
- `offset` (string, optional) — `offset` mode: signed BRL amount per unit added to the Binance spot, 4 decimal places. Requests may still send the deprecated integer `offsetCents`; responses only send `offset`.
- `price` (string, optional, nullable) — Current BRL price per unit, 4 decimal places; `null` without a usable quote.
- `fixedPrice` (string, optional) — Fixed price per unit, 4 decimal places (owner).
- `limitsUnit` (enum, optional) — Unit the advertiser set the per-order range in.
  - Allowed values: `brl`, `asset`
- `minAmount` (string, optional) — Minimum BRL per order. With `limitsUnit` `asset` it is `minAssetAmount` at the price shown, so it moves with the price.
- `maxAmount` (string, optional) — Maximum BRL per order. With `limitsUnit` `asset` it is `maxAssetAmount` at the price shown.
- `minAssetAmount` (string, optional) — Minimum crypto per order. Only with `limitsUnit` `asset`.
- `maxAssetAmount` (string, optional) — Maximum crypto per order. Only with `limitsUnit` `asset`.
- `availableAmount` (string, optional) — Crypto available (stock minus reserved).
- `stockAmount` (string, optional) — Total stock (owner).
- `reservedAmount` (string, optional) — Reserved by open orders (owner).
- `walletId` (string, optional) — Ad wallet (owner).
- `deliveryDeadlineMin` (integer, optional) — Minutes to send after both sign.
- `instructions` (string, optional) — Advertiser instructions.
- `instructionsFlagged` (boolean, optional) — Instructions flagged for review (owner).
- `status` (enum, optional) — Ad status.
  - Allowed values: `active`, `paused`, `closed`
- `pausedReason` (string, optional) — Why the ad was paused automatically (owner). `cashout_locked` means the holder blocked the account's cashout; reactivate after unblocking.
- `hiddenReason` (enum, optional) — Owner only, active buy ads: why the market is not showing the ad right now. `cashout_locked`: cashout blocked; `cashout_outside_hours`: outside the account's cashout hours (comes back when the window opens).
  - Allowed values: `cashout_locked`, `cashout_outside_hours`
- `advertiser` (P2PAdAdvertiser, optional) — Advertiser (market listing).
- `createdAt` (datetime, optional, nullable) — Creation time.
- `updatedAt` (datetime, optional, nullable) — Last change.

## Errors

### 400 Bad Request Error

`invalid_payload` or `invalid_amount`.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 403 Forbidden Error

`feature_disabled`, `holder_only` or `advertiser_not_approved`.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 404 Not Found Error

`ad_not_found`.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 409 Conflict Error

`ad_closed`.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 422 Unprocessable Entity Error

`invalid_spread`, `stock_below_reserved`, `amount_above_cap`, `delivery_deadline_out_of_range` or `wallet_not_approved`.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 423 Locked Error

`cashout_locked`: buy ad with the account's cashout blocked.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

## Types

### P2PAdAdvertiser

Advertiser (market listing).

- `username` (string, optional) — Username.
- `reputation` (P2PReputation, optional) — Trading statistics. Values below the tenant's minimum number of orders are `null`.

### ErrorResponsePartner

Raw error from the settlement bank, when the failure came from it. Diagnostic only.

- `code` (string, optional)
- `message` (string, optional)
- `field` (string, optional) — Field the partner pointed at, when any.

### P2PReputation

Trading statistics. Values below the tenant's minimum number of orders are `null`.

- `tradesTotal` (integer, optional) — Completed orders.
- `completionPercent` (string, optional, nullable) — Completed over taken orders, in percent.
- `deliveryMedianSeconds` (integer, optional, nullable) — Median seconds between both signing and the crypto being sent.
- `deliveryPercentile` (integer, optional, nullable) — Percentile of the delivery time within the market (higher is faster).

## Examples

**Request**

```json
{
  "spreadBps": 60,
  "status": "paused"
}
```

**Response**

```json
{
  "adId": "p2a_01JB8Z6Q4C9K7X2M3N5P",
  "side": "sell",
  "pair": "USDT_TRON",
  "priceMode": "spread",
  "spreadBps": 80,
  "price": "5.46",
  "minAmount": "100.00",
  "maxAmount": "5000.00",
  "availableAmount": "1500.000000",
  "stockAmount": "2000.000000",
  "reservedAmount": "500.000000",
  "walletId": "p2w_01JB8Z6Q4C9K7X2M3N5P",
  "deliveryDeadlineMin": 30,
  "instructionsFlagged": false,
  "status": "active",
  "createdAt": "2026-10-31T14:05:00Z",
  "updatedAt": "2026-10-31T14:05:00Z"
}
```

**SDK Code**

```python P2P_updateP2PAd_example
import requests

url = "https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P"

payload = {
    "spreadBps": 60,
    "status": "paused"
}
headers = {
    "X-Content-SHA256": "X-Content-SHA256",
    "X-Request-Signature": "X-Request-Signature",
    "X-Request-Timestamp": "X-Request-Timestamp",
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript P2P_updateP2PAd_example
const url = 'https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P';
const options = {
  method: 'PATCH',
  headers: {
    'X-Content-SHA256': 'X-Content-SHA256',
    'X-Request-Signature': 'X-Request-Signature',
    'X-Request-Timestamp': 'X-Request-Timestamp',
    'X-Tenant-Id': 'X-Tenant-Id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"spreadBps":60,"status":"paused"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go P2P_updateP2PAd_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P"

	payload := strings.NewReader("{\n  \"spreadBps\": 60,\n  \"status\": \"paused\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("X-Content-SHA256", "X-Content-SHA256")
	req.Header.Add("X-Request-Signature", "X-Request-Signature")
	req.Header.Add("X-Request-Timestamp", "X-Request-Timestamp")
	req.Header.Add("X-Tenant-Id", "X-Tenant-Id")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby P2P_updateP2PAd_example
require 'uri'
require 'net/http'

url = URI("https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-Content-SHA256"] = 'X-Content-SHA256'
request["X-Request-Signature"] = 'X-Request-Signature'
request["X-Request-Timestamp"] = 'X-Request-Timestamp'
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"spreadBps\": 60,\n  \"status\": \"paused\"\n}"

response = http.request(request)
puts response.read_body
```

```java P2P_updateP2PAd_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P")
  .header("X-Content-SHA256", "X-Content-SHA256")
  .header("X-Request-Signature", "X-Request-Signature")
  .header("X-Request-Timestamp", "X-Request-Timestamp")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"spreadBps\": 60,\n  \"status\": \"paused\"\n}")
  .asString();
```

```php P2P_updateP2PAd_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P', [
  'body' => '{
  "spreadBps": 60,
  "status": "paused"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Content-SHA256' => 'X-Content-SHA256',
    'X-Request-Signature' => 'X-Request-Signature',
    'X-Request-Timestamp' => 'X-Request-Timestamp',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

echo $response->getBody();
```

```csharp P2P_updateP2PAd_example
using RestSharp;

var client = new RestClient("https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P");
var request = new RestRequest(Method.PATCH);
request.AddHeader("X-Content-SHA256", "X-Content-SHA256");
request.AddHeader("X-Request-Signature", "X-Request-Signature");
request.AddHeader("X-Request-Timestamp", "X-Request-Timestamp");
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"spreadBps\": 60,\n  \"status\": \"paused\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift P2P_updateP2PAd_example
import Foundation

let headers = [
  "X-Content-SHA256": "X-Content-SHA256",
  "X-Request-Signature": "X-Request-Signature",
  "X-Request-Timestamp": "X-Request-Timestamp",
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "spreadBps": 60,
  "status": "paused"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://client.api.corpx.com/v1/accounts/accountId/p2p/ads/p2a_01JB8Z6Q4C9K7X2M3N5P")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```