> This page is for BaaS.

> 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.

# Create an ad

POST https://tenant.api.corpx.com/v1/accounts/{accountId}/p2p/ads
Content-Type: application/json

Creates an ad. Approved advertisers only. Scope `p2p.ads`. A buy ad needs the account's cashout unblocked (`423 cashout_locked`): the order amount is held from this account. Outside the account's cashout hours the buy ad is created but stays off the market (`hiddenReason`) until the window opens.


Reference: https://en.docs.api.corpx.com/baas/referencia/p-2-p/create-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.

### 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).

### 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

### 201

Ad created

- `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`, `invalid_amount` or `missing_fields`.

- `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

Account not found or `wallet_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.

### 422 Unprocessable Entity Error

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

- `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
{
  "side": "sell",
  "pair": "USDT_TRON",
  "priceMode": "spread",
  "spreadBps": 80,
  "stockAmount": "2000",
  "minAmount": "100.00",
  "maxAmount": "5000.00",
  "deliveryDeadlineMin": 30,
  "walletId": "p2w_01JB8Z6Q4C9K7X2M3N5P"
}
```

**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_createP2PAd_example
import requests

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

payload = {
    "side": "sell",
    "pair": "USDT_TRON",
    "priceMode": "spread",
    "spreadBps": 80,
    "stockAmount": "2000",
    "minAmount": "100.00",
    "maxAmount": "5000.00",
    "deliveryDeadlineMin": 30,
    "walletId": "p2w_01JB8Z6Q4C9K7X2M3N5P"
}
headers = {
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript P2P_createP2PAd_example
const url = 'https://tenant.api.corpx.com/v1/accounts/accountId/p2p/ads';
const options = {
  method: 'POST',
  headers: {
    'X-Tenant-Id': 'X-Tenant-Id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"side":"sell","pair":"USDT_TRON","priceMode":"spread","spreadBps":80,"stockAmount":"2000","minAmount":"100.00","maxAmount":"5000.00","deliveryDeadlineMin":30,"walletId":"p2w_01JB8Z6Q4C9K7X2M3N5P"}'
};

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

```go P2P_createP2PAd_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"side\": \"sell\",\n  \"pair\": \"USDT_TRON\",\n  \"priceMode\": \"spread\",\n  \"spreadBps\": 80,\n  \"stockAmount\": \"2000\",\n  \"minAmount\": \"100.00\",\n  \"maxAmount\": \"5000.00\",\n  \"deliveryDeadlineMin\": 30,\n  \"walletId\": \"p2w_01JB8Z6Q4C9K7X2M3N5P\"\n}")

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

	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_createP2PAd_example
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"side\": \"sell\",\n  \"pair\": \"USDT_TRON\",\n  \"priceMode\": \"spread\",\n  \"spreadBps\": 80,\n  \"stockAmount\": \"2000\",\n  \"minAmount\": \"100.00\",\n  \"maxAmount\": \"5000.00\",\n  \"deliveryDeadlineMin\": 30,\n  \"walletId\": \"p2w_01JB8Z6Q4C9K7X2M3N5P\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://tenant.api.corpx.com/v1/accounts/accountId/p2p/ads")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"side\": \"sell\",\n  \"pair\": \"USDT_TRON\",\n  \"priceMode\": \"spread\",\n  \"spreadBps\": 80,\n  \"stockAmount\": \"2000\",\n  \"minAmount\": \"100.00\",\n  \"maxAmount\": \"5000.00\",\n  \"deliveryDeadlineMin\": 30,\n  \"walletId\": \"p2w_01JB8Z6Q4C9K7X2M3N5P\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tenant.api.corpx.com/v1/accounts/accountId/p2p/ads', [
  'body' => '{
  "side": "sell",
  "pair": "USDT_TRON",
  "priceMode": "spread",
  "spreadBps": 80,
  "stockAmount": "2000",
  "minAmount": "100.00",
  "maxAmount": "5000.00",
  "deliveryDeadlineMin": 30,
  "walletId": "p2w_01JB8Z6Q4C9K7X2M3N5P"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

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

```csharp P2P_createP2PAd_example
using RestSharp;

var client = new RestClient("https://tenant.api.corpx.com/v1/accounts/accountId/p2p/ads");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"side\": \"sell\",\n  \"pair\": \"USDT_TRON\",\n  \"priceMode\": \"spread\",\n  \"spreadBps\": 80,\n  \"stockAmount\": \"2000\",\n  \"minAmount\": \"100.00\",\n  \"maxAmount\": \"5000.00\",\n  \"deliveryDeadlineMin\": 30,\n  \"walletId\": \"p2w_01JB8Z6Q4C9K7X2M3N5P\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift P2P_createP2PAd_example
import Foundation

let headers = [
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "side": "sell",
  "pair": "USDT_TRON",
  "priceMode": "spread",
  "spreadBps": 80,
  "stockAmount": "2000",
  "minAmount": "100.00",
  "maxAmount": "5000.00",
  "deliveryDeadlineMin": 30,
  "walletId": "p2w_01JB8Z6Q4C9K7X2M3N5P"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://tenant.api.corpx.com/v1/accounts/accountId/p2p/ads")! 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()
```