Create a listing
const url = 'https://acme.mykreezalid.com/front_api/v1/listings';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"title":"Blue city bike","description":"<p>A light city bike.</p>","category_id":31,"order_type_id":20,"order_type_url_token":"example","price":120,"sku":"SKU-4242","quantity":12,"external_id":"REF-4242","location":"10 Main Street, Springfield","city":"Springfield","state":"IL","country":"US","lat":39.7817,"lng":-89.6501,"weight":12.5,"visibility":"both","status":"draft","attributes":{"color":"Blue","size":["S","M"]},"images":["https://example.com/bike-front.jpg"]}'};
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://acme.mykreezalid.com/front_api/v1/listings \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "title": "Blue city bike", "description": "<p>A light city bike.</p>", "category_id": 31, "order_type_id": 20, "order_type_url_token": "example", "price": 120, "sku": "SKU-4242", "quantity": 12, "external_id": "REF-4242", "location": "10 Main Street, Springfield", "city": "Springfield", "state": "IL", "country": "US", "lat": 39.7817, "lng": -89.6501, "weight": 12.5, "visibility": "both", "status": "draft", "attributes": { "color": "Blue", "size": [ "S", "M" ] }, "images": [ "https://example.com/bike-front.jpg" ] }'Creates a listing owned by the signed-in member. Any user_id you send is ignored. The listing gets the order type you name with order_type_id or order_type_url_token, or else the marketplace’s first available one. Its currency and whether it requires shipping come from that order type. Unless you send status, it is published; its moderation status is waiting when the order type requires approval and approved otherwise. The response always has status 200: check success. Validation errors are not detailed, only summed up in message.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The listing. Other listing fields are stored as sent.
object
Example
Blue city bikeDescription. HTML is converted to plain text.
Example
<p>A light city bike.</p>Example
31Order type of the listing.
Example
20URL key of the order type, used when order_type_id is not sent.
Required when the order type has prices enabled.
Example
120Required when the order type has SKUs enabled.
Example
SKU-4242Stock.
Example
12Your own reference.
Example
REF-4242Example
10 Main Street, SpringfieldExample
SpringfieldExample
ILExample
USExample
39.7817Example
-89.6501Example
12.5Defaults to both.
Defaults to published.
Attribute values keyed by attribute alias (see GET /listings/attributes). Unknown aliases are dropped. For select and checkbox attributes, send option titles, as an array or as one string separated by ##; titles that do not exist yet are added to the attribute’s options.
object
Example
{ "color": "Blue", "size": [ "S", "M" ]}Public image URLs. Each image is downloaded and stored by the marketplace; the order of the array is the display order. Images that cannot be fetched are skipped.
Example
[ "https://example.com/bike-front.jpg"]Responses
Section titled “Responses”Outcome of the creation. success is false and id is null when the title is missing (Title is missing), when the listing is invalid (Error. Listing could not be created) or when no order type is defined (Order type is not defined).
object
ID of the new listing.
Example
{ "id": 4242, "message": "Listing created", "success": true}No valid access token was sent.
Error body returned by the Front API when it refuses a request.
object
HTTP status code, repeated in the body.
Human-readable reason.
Example
{ "code": 403, "status": "error", "message": "Token not found in request"}