Make coupons from a CSV, its bytes the body (UTF-8, up to 50 000 rows and 5 MiB; columns code, match, campaign, offer, precedence, status, ends_at and note), each row made or refused on its own; validate_only checks it, making nothing
POST
/v1/buyer/coupons/import
const url = 'https://example.com/v1/buyer/coupons/import';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream'}, body: 'binary'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/buyer/coupons/import \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/octet-stream' \ --data binaryWho: a workspace’s buyer, or its key. API keys with the buyer:write scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Made once per action and sent again on every retry of it, so the service acts once: the request_id of the create or money-moving call; a new one when left out
Query Parameters
Section titled “Query Parameters”delimiter
string
time_zone
string
validate_only
string
Request Bodyrequired
Section titled “Request Bodyrequired”string format: binary
string format: binary
string format: binary
string format: binary
Responses
Section titled “Responses”OK
Media typeapplication/json
object
delimiter
required
string
made
required
integer format: int32
refused
required
integer format: int32
results
required
Array<object>
object
column
required
string
malformed
required
boolean
reason
required
string | null
row
required
integer format: int32
value
required
string
rows
required
integer format: int32
Example
{ "results": [ { "reason": "campaign_not_found" } ]}default
Section titled “default”An error, as go-commons apperr maps it
Media typeapplication/json
object
error
required
object
code
required
string
fields
object
key
additional properties
string
message
required
string
Example generated
{ "error": { "code": "example", "fields": { "additionalProperty": "example" }, "message": "example" }}