Pular para o conteúdo

Change an ad campaign

PATCH
/v1/ads/{marketplace}/campaigns/{campaign_id}
curl --request PATCH \
--url https://open-api.live.gobots.com.br/v1/ads/meli/campaigns/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \
--data '{ "name": "example", "status": "active", "budget": { "amount": "example" }, "strategy": { "roas_target": "example" } }'

Changes the name, the status (active or paused, never ended), the daily budget or the ROAS target of one campaign. A campaign that has ended cannot be reactivated. The write is one audited action: meta.action_id identifies it, and a 202 is polled at getAdAction. The responses are never cached.

marketplace
required
string
Allowed values: meli amazon magalu shopee viavarejo b2w whatsapp qa tiktok

Marketplace of the Ads account. Only meli has an adapter in v1; the others answer 501.

campaign_id
required
string
/^[A-Za-z0-9_-]{1,64}$/

The marketplace’s own campaign id. An id outside the charset answers 404.

Idempotency-Key
required
string format: uuid

One UUID per intent, reused on every retry of that intent. Kept for 24 hours per merchant and route: the same key with the same body answers the original response again (marked Idempotent-Replayed: true), and with a different body answers 409 idempotency_conflict. A request that is not valid never uses up its key.

Media typeapplication/json
object
>= 1 properties
name
string
>= 1 characters <= 255 characters
status

Never ended. An ended campaign cannot be reactivated.

string
Allowed values: active paused
budget
object
>= 1 properties
amount

Daily budget, a positive decimal with at most 2 decimal places, at most 1000000000.

string
/^[0-9]+(\.[0-9]+)?$/
strategy
object
>= 1 properties
roas_target

Between 1.0 and 35.0, inclusive.

string
/^[0-9]+(\.[0-9]+)?$/

The write reached a terminal state; the refreshed campaign is present when the marketplace echoed it.

Media typeapplication/json
object
campaign
object
id
required

The marketplace’s own campaign id.

string
marketplace
required
string
Allowed values: meli amazon magalu shopee viavarejo b2w whatsapp qa tiktok
store_id
required

Opaque store id.

string
advertiser_id
required
string | null
name
required
string
status
required
string
Allowed values: active paused ended
budget
required
One of:
object
amount
required

Decimal string, null when the marketplace sets it automatically.

string | null
currency
required
string
automatic
required
boolean | null
strategy
required
One of:
object
type
required
One of:
string
Allowed values: profitability increase visibility
acos_target
required

Decimal string, a ratio in [0,1].

string | null
roas_target
required
string | null
gobots
required
object
managed
required

Whether GoBots automation manages this campaign.

boolean
automation
required
One of:
object
roas_target
required
string | null
metrics
required
One of:

A campaign’s current metric snapshot, or one bucket of a metric series. Ratios are decimal strings. A metric the origin did not send is absent, never zero. In a series every ratio is re-derived from the bucket’s sums (4 decimals, money 2) and is absent when its denominator is zero; share_of_voice is present on day buckets only.

object
spend
object
amount
required

Decimal string.

string
currency
required

ISO 4217, uppercase.

string
impressions
integer format: int64
clicks
integer format: int64
ctr
string
cpc
object
amount
required

Decimal string.

string
currency
required

ISO 4217, uppercase.

string
attributed_sales
object
amount
required

Decimal string.

string
currency
required

ISO 4217, uppercase.

string
acos
string
roas
string
remote_data
required

Marketplace-specific fields, keyed by marketplace and then by a documented key. Campaign: channel. Campaign metrics: share_of_voice (decimal string, a ratio in [0,1]). Ad group: status (the marketplace’s own), ad_group_type. Opportunity: action (an action outside the published set).

object
key
additional properties
object
key
additional properties
string
created_at
required
string | null format: date-time
updated_at
required
string | null format: date-time
remote_data
required

Marketplace-specific fields, keyed by marketplace and then by a documented key. Campaign: channel. Campaign metrics: share_of_voice (decimal string, a ratio in [0,1]). Ad group: status (the marketplace’s own), ad_group_type. Opportunity: action (an action outside the published set).

object
key
additional properties
object
key
additional properties
string
result
required
object
status
required

The state of an action. applied, partially_applied, failed and dismissed are terminal.

string
Allowed values: awaiting_confirmation pending reconciling unknown applied partially_applied failed dismissed
reason

A closed code, never free text. outcome_unknown means the marketplace’s answer could not be read and the change must be verified by hand.

string
Allowed values: budget_below_minimum budget_above_maximum campaign_ended invalid_roas_target advertiser_suspended campaign_not_editable ad_group_not_found opportunity_not_found opportunity_not_applicable opportunity_locked not_found unmapped origin_misconfigured origin_overloaded origin_rejected_request origin_protocol_error outcome_unknown not_dispatched
applied_as

Present when an opportunity that proposed removing an ad was applied as a pause.

string
Allowed values: pause
details
required

One entry per requested target on a batch; the targets that failed on partially_applied.

Array<object>
object
target_type
required
string
Allowed values: campaign ad_group opportunity
target_id
required
string
status
required
string
Allowed values: applied failed pending
reason

A closed code, never free text. outcome_unknown means the marketplace’s answer could not be read and the change must be verified by hand.

string
Allowed values: budget_below_minimum budget_above_maximum campaign_ended invalid_roas_target advertiser_suspended campaign_not_editable ad_group_not_found opportunity_not_found opportunity_not_applicable opportunity_locked not_found unmapped origin_misconfigured origin_overloaded origin_rejected_request origin_protocol_error outcome_unknown not_dispatched
meta
required
object
action_id
required
string
/^act_[0-9A-HJKMNP-TV-Z]{26}$/

Example

{
"campaign": {
"marketplace": "meli",
"status": "active",
"strategy": {
"type": "profitability"
},
"metrics": {
"spend": {
"amount": "250.0"
},
"cpc": {
"amount": "250.0"
},
"attributed_sales": {
"amount": "250.0"
}
}
},
"result": {
"status": "awaiting_confirmation",
"reason": "budget_below_minimum",
"applied_as": "pause",
"details": [
{
"target_type": "campaign",
"status": "applied",
"reason": "budget_below_minimum"
}
]
}
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

Idempotent-Replayed
boolean

Present and true only when this response is a stored replay of an earlier identical request.

The write is still moving: result.status is pending, reconciling or unknown. Poll the action named by Location until it is terminal. The response is never cached.

Media typeapplication/json
object
result
required
object
status
required

The state of an action. applied, partially_applied, failed and dismissed are terminal.

string
Allowed values: awaiting_confirmation pending reconciling unknown applied partially_applied failed dismissed
reason

A closed code, never free text. outcome_unknown means the marketplace’s answer could not be read and the change must be verified by hand.

string
Allowed values: budget_below_minimum budget_above_maximum campaign_ended invalid_roas_target advertiser_suspended campaign_not_editable ad_group_not_found opportunity_not_found opportunity_not_applicable opportunity_locked not_found unmapped origin_misconfigured origin_overloaded origin_rejected_request origin_protocol_error outcome_unknown not_dispatched
applied_as

Present when an opportunity that proposed removing an ad was applied as a pause.

string
Allowed values: pause
details
required

One entry per requested target on a batch; the targets that failed on partially_applied.

Array<object>
object
target_type
required
string
Allowed values: campaign ad_group opportunity
target_id
required
string
status
required
string
Allowed values: applied failed pending
reason

A closed code, never free text. outcome_unknown means the marketplace’s answer could not be read and the change must be verified by hand.

string
Allowed values: budget_below_minimum budget_above_maximum campaign_ended invalid_roas_target advertiser_suspended campaign_not_editable ad_group_not_found opportunity_not_found opportunity_not_applicable opportunity_locked not_found unmapped origin_misconfigured origin_overloaded origin_rejected_request origin_protocol_error outcome_unknown not_dispatched
meta
required
object
action_id
required
string
/^act_[0-9A-HJKMNP-TV-Z]{26}$/

Example

{
"result": {
"status": "awaiting_confirmation",
"reason": "budget_below_minimum",
"applied_as": "pause",
"details": [
{
"target_type": "campaign",
"status": "applied",
"reason": "budget_below_minimum"
}
]
}
}
Location
required
string

The action to poll, /v1/ads/{marketplace}/actions/{action_id}.

RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

The request is not valid: invalid_request (a malformed header, path or body, with the field named), idempotency_key_required, invalid_roas_target (outside 1.0 to 35.0) or invalid_status_transition (an ended campaign cannot be reactivated).

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

The API key is missing, malformed, unknown, revoked or expired.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
WWW-Authenticate
string

Bearer challenge for the API realm.

The merchant does not have the Open API add-on active.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}

The resource, or a requested store, is not this merchant’s or does not exist; the two are indistinguishable.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

idempotency_conflict when the key was used with another body; opportunity_not_applicable when the opportunity was already applied, dismissed or expired; opportunity_locked while another request with the same key, or another apply of the same opportunity, is still running.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

The requests-per-minute limit of the endpoint group was exceeded (rate_limited), or the monthly request quota of the merchant is exhausted (quota_exceeded).

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

Retry-After
required
integer

Seconds to wait before retrying, per RFC 9110.

The route or marketplace is published but its adapter is not available yet.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

source_rejected: the marketplace refused the change. The message is one fixed sentence chosen by the reason, never the marketplace’s own text.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
required
string

The policies that apply to this endpoint group, as draft-ietf-httpapi-ratelimit-headers policy members: "<group>";q=<quota>;w=<window seconds>.

RateLimit
required
string

The state of the endpoint group’s window: "<group>";r=<remaining>;t=<seconds to reset>.

The upstream source is unavailable. When the merchant’s entitlement could not be resolved the request is refused before rate limiting, so the RateLimit headers are absent.

Media typeapplication/json
object
code
required

Stable machine readable error code.

string
message
required

Human readable explanation. Never carries raw upstream text.

string
retry_after

Seconds to wait before retrying.

integer
limit

Limit that was exceeded.

integer
remaining

Remaining allowance in the current window.

integer

Example generated

{
"code": "example",
"message": "example",
"retry_after": 1,
"limit": 1,
"remaining": 1
}
RateLimit-Policy
string

As the RateLimit-Policy response header; absent when entitlement could not be resolved.

RateLimit
string

As the RateLimit response header; absent when entitlement could not be resolved.