{"id":971,"date":"2024-01-28T14:14:06","date_gmt":"2024-01-28T14:14:06","guid":{"rendered":"https:\/\/olxdoc.wpenginepowered.com\/?p=971"},"modified":"2024-01-30T12:45:56","modified_gmt":"2024-01-30T12:45:56","slug":"create-advert","status":"publish","type":"post","link":"https:\/\/doc.olxgroup.com\/api\/?p=971","title":{"rendered":"Create advert"},"content":{"rendered":"\r\n<h2>Create advert<\/h2>\r\n<p>&nbsp;<\/p>\r\n<h2 id=\"validation-rules\">Validation rules<\/h2>\r\n<ul>\r\n<li>Following characters cannot be provided in the title and in the description three times in a row: <strong>!\u00a0?\u00a0.\u00a0,\u00a0&#8211;\u00a0=\u00a0+\u00a0#\u00a0%\u00a0&amp;\u00a0@\u00a0*\u00a0_\u00a0&gt;\u00a0&lt;\u00a0:\u00a0(\u00a0)\u00a0|<\/strong><\/li>\r\n<li>The amount of capital letters in the title and in the ad description cannot be greater than 50% of a whole text.<\/li>\r\n<li>The title has to be at least 16 characters long and cannot be longer than 70 characters.<\/li>\r\n<li>The description has to be at least 80 characters long and cannot be longer than 9000 characters.<\/li>\r\n<li>E-mail addresses and phone numbers are not allowed in the title and in the description.<\/li>\r\n<li>Salary currency has to be written in uppercase (for example: <strong>EUR<\/strong> instead of <strong>eur<\/strong>).<\/li>\r\n<li>Lower or upper value of the salary cannot be greater than 99999999999999.<\/li>\r\n<\/ul>\r\n<h2 id=\"advert-lifecycle\">Advert lifecycle<\/h2>\r\n<ul>\r\n<li>Post new advert<\/li>\r\n<li>In response you will get current status of posted advert:\r\n<ul>\r\n<li>if status is <strong>limited<\/strong>\u00a0then you must buy packet for advert or category and activate advert (check out Packets section and Adverts section)<\/li>\r\n<li>if status is <strong>new<\/strong>\u00a0then flow goes to point 3.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Advert is awaiting for moderation. Usually it takes some seconds.\r\n<ul>\r\n<li>if advert is accepted it will be activated automatically and visible for all users<\/li>\r\n<li>if advert is rejected (possible reasons: scam, illegal items offered etc)<\/li>\r\n<li>if advert is rejected but user can fix issues, and advert goes back to moderation<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>Advert is active. How long advert will be valid is defined in field <strong>valid_to<\/strong>\u00a0in advert response.<\/li>\r\n<li>When &#8220;valid to&#8221; date is passed, advert becomes outdated &#8211; user can activate advert again.<\/li>\r\n<\/ul>\r\n<p>User can manually deactivate advert, status is set to <strong>removed_by_user<\/strong>. Deactivated advert can be activated again. To completly remove advert user should deactivate it at first and then delete it (check out Adverts section).<\/p>\r\n<h2 id=\"advert-statuses\">Advert statuses<\/h2>\r\n<ul>\r\n<li>new: fresh advert before activation and moderation<\/li>\r\n<li>active: visible on OLX<\/li>\r\n<li>limited: advert exceeded limit of free adverts in selected category<\/li>\r\n<li>removed_by_user: manually removed by user<\/li>\r\n<li>outdated: advert reached expiration date<\/li>\r\n<li>unconfirmed: waiting for confirmation<\/li>\r\n<li>unpaid: waiting for payment<\/li>\r\n<li>moderated: negative moderation result<\/li>\r\n<li>blocked: blocked by moderation<\/li>\r\n<li>disabled: disabled by moderation, offer blocked and waiting for verification<\/li>\r\n<li>removed_by_moderator: removed by moderator<\/li>\r\n<\/ul>\r\n<h2 id=\"posting-advert\">Posting Advert<\/h2>\r\n<p>To add an advert client have to send request to <strong>\/api\/partner\/adverts<\/strong>\u00a0endpoint.<\/p>\r\n<p>This endpoint requires POST HTTP method, and expects data to be sent as JSON along with <strong>Content-Type: application\/json header.<\/strong><\/p>\r\n<p>Remember to send Authorization: <strong>Bearer ACCESS_TOKEN<\/strong> and <strong>Version: 2.0<\/strong>\u00a0headers either.<\/p>\r\n<p>Using this endpoint creates advert in the name of currently authenticated user.<\/p>\r\n<p>You must send all required fields (as it&#8217;s described in <strong>\/api\/partner\/adverts<\/strong>\u00a0endpoint reference), inlcuding required attributes.<\/p>\r\n<p>For list of available categories, attributes, cities please check out appropriate endpoint references like\u00a0<strong>\/api\/partner\/categories<\/strong>, <strong>\/api\/partner\/cities<\/strong>\u00a0and so on.<\/p>\r\n<p>You can get list of required attributes by <strong>\/api\/partner\/categories\/ID\/attributes<\/strong>\u00a0endpoint where ID is the category ID you choosed. Endpoint return list of required and optional attributes to create advert &#8211; attributes vary in different countries and categories.<\/p>\r\n<p>Important: please note that attributes with type salary and price have different structures than normal attributes. For more details about those attributes please read Create advert endpoint description.<\/p>\r\n<p>When some required fields are missing in response you will get a list of errors as a result:<\/p>\r\n<p><button>Copy<\/button> Copied to clipboard<\/p>\r\n<p>API will return full advert model if request succeded:<\/p>\r\n<p><button>Copy<\/button> Copied to clipboard<\/p>\r\n<p>If status is <strong>new<\/strong>, it&#8217;s mean that advert will be activated soon (after moderation process). But if status is <strong>limited<\/strong>\u00a0you must perform two extra steps:<\/p>\r\n<ul>\r\n<li>buy &#8220;packet&#8221; for a single advert (check out <strong>\/api\/partner\/adverts\/ID\/packets<\/strong>) or whole category (check out <strong>\/api\/partner\/users\/me\/packets<\/strong>).<\/li>\r\n<li>activate advert (checkout <strong>\/api\/partner\/adverts\/ID\/commands<\/strong> &#8211; <strong>activate<\/strong>\u00a0command)<\/li>\r\n<\/ul>\r\n<p>After some time (usually few seconds) advert should become <strong>active<\/strong>\u00a0and be visible to all users.<\/p>\r\n<p>You can <strong>deactivate<\/strong> active advert with deactivate command (checkout <strong>\/api\/partner\/adverts\/ID\/commands<\/strong>). You can activate inactive advert with activate command.<\/p>\r\n<p>If you want to completely <strong>remove<\/strong> advert please use <strong>DEL \/api\/partner\/adverts\/ID\/<\/strong>\u00a0endpoint.<\/p>\r\n<p>You can buy extra paid features for active advert. For more details check out &#8220;Paid features&#8221; section.<\/p>\r\n<h5>AUTHORIZATIONS: <i>access_token<\/i><\/h5>\r\n<h5>REQUEST BODY SCHEMA:\u00a0application\/json<\/h5>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td title=\"title\">title required<\/td>\r\n<td>string<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"description\">description required<\/td>\r\n<td>string\r\n<p>May contain html tags (only in Jobs category) &lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;&lt;p&gt;<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"category_id\">category_id required<\/td>\r\n<td>integer<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"advertiser_type\">advertiser_type required<\/td>\r\n<td>string Enum:\u00a0&#8220;private&#8221;\u00a0&#8220;business&#8221;<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"external_url\">external_url<\/td>\r\n<td>string\r\n<p>Advert&#8217;s URL in origin system<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"external_id\">external_id<\/td>\r\n<td>string\r\n<p>Advert&#8217;s ID in origin system<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"contact\"><button aria-label=\"expand contact\">contact<\/button> required<\/td>\r\n<td>object<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"location\"><button aria-label=\"expand location\">location<\/button> required<\/td>\r\n<td>object<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"images\"><button aria-label=\"expand images\">images<\/button><\/td>\r\n<td>Array of\u00a0objects<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"price\"><button aria-label=\"expand price\">price<\/button><\/td>\r\n<td>object\r\n<p>Used by most of the categories, i.e. cars, houses, clothes, etc. Required by most of the mentioned categories.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"salary\"><button aria-label=\"expand salary\">salary<\/button><\/td>\r\n<td>object\r\n<p>Used by some of the categories, i.e. jobs. Required by most of the mentioned categories.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"attributes\"><button aria-label=\"expand attributes\">attributes<\/button> required<\/td>\r\n<td>Array of\u00a0objects<\/td>\r\n<\/tr>\r\n<tr>\r\n<td title=\"courier\">courier<\/td>\r\n<td>boolean\r\n<p>Is delivery possible. If true that means that delivery is possible. (Available in BG, KZ, PT, RO).<\/p>\r\n<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h3>Responses<\/h3>\r\n<p><strong>200<\/strong><\/p>\r\n<p>Status 200<\/p>\r\n<p>OLX Production Server<\/p>\r\n<p>https:\/\/www.olx.ro\/api\/partner\/adverts <code>POST\r\n\/adverts\r\nRequest samples\r\nPayload\r\nContent type\r\napplication\/json\r\n{\r\n\"title\": \"string\",\r\n\"description\": \"string\",\r\n\"category_id\": 0,\r\n\"advertiser_type\": \"private\",\r\n\"external_url\": \"string\",\r\n\"external_id\": \"string\",\r\n\"contact\": {\r\n\"name\": \"string\",\r\n\"phone\": \"string\"\r\n},\r\n\"location\": {\r\n\"city_id\": 0,\r\n\"district_id\": 0,\r\n\"latitude\": 0,\r\n\"longitude\": 0\r\n},\r\n\"images\": [\r\n{}\r\n],\r\n\"price\": {\r\n\"value\": 0,\r\n\"currency\": \"string\",\r\n\"negotiable\": true,\r\n\"trade\": true,\r\n\"budget\": true\r\n},\r\n\"salary\": {\r\n\"value_from\": 0,\r\n\"value_to\": 0,\r\n\"currency\": \"string\",\r\n\"negotiable\": true,\r\n\"type\": \"hourly\"\r\n},\r\n\"attributes\": [\r\n{}\r\n],\r\n\"courier\": true\r\n}\t\t\t<\/code> <button>Copy<\/button> POST \/adverts Request samples Payload Content type application\/json { &#8220;title&#8221;: &#8220;string&#8221;, &#8220;description&#8221;: &#8220;string&#8221;, &#8220;category_id&#8221;: 0, &#8220;advertiser_type&#8221;: &#8220;private&#8221;, &#8220;external_url&#8221;: &#8220;string&#8221;, &#8220;external_id&#8221;: &#8220;string&#8221;, &#8220;contact&#8221;: { &#8220;name&#8221;: &#8220;string&#8221;, &#8220;phone&#8221;: &#8220;string&#8221; }, &#8220;location&#8221;: { &#8220;city_id&#8221;: 0, &#8220;district_id&#8221;: 0, &#8220;latitude&#8221;: 0, &#8220;longitude&#8221;: 0 }, &#8220;images&#8221;: [ {} ], &#8220;price&#8221;: { &#8220;value&#8221;: 0, &#8220;currency&#8221;: &#8220;string&#8221;, &#8220;negotiable&#8221;: true, &#8220;trade&#8221;: true, &#8220;budget&#8221;: true }, &#8220;salary&#8221;: { &#8220;value_from&#8221;: 0, &#8220;value_to&#8221;: 0, &#8220;currency&#8221;: &#8220;string&#8221;, &#8220;negotiable&#8221;: true, &#8220;type&#8221;: &#8220;hourly&#8221; }, &#8220;attributes&#8221;: [ {} ], &#8220;courier&#8221;: true } Copied to clipboard <code>Response samples\r\n200\r\nContent type\r\napplication\/json\r\n{\r\n\"data\": {\r\n\"id\": 123,\r\n\"status\": \"active\",\r\n\"url\": \"https:\/\/www.olx.ro\/oferta\/url.html\",\r\n\"created_at\": \"2018-02-02 09:35:16\",\r\n\"activated_at\": \"2018-02-02 09:32:52\",\r\n\"valid_to\": \"2018-03-04 09:32:52\",\r\n\"title\": \"This is title\",\r\n\"description\": \"This is description\",\r\n\"category_id\": 123,\r\n\"advertiser_type\": \"private\",\r\n\"external_id\": 12345,\r\n\"external_url\": \"http:\/\/myshop.com\/advert\/123\",\r\n\"contact\": {},\r\n\"images\": [],\r\n\"price\": {},\r\n\"salary\": null,\r\n\"attributes\": [],\r\n\"courier\": null\r\n}\r\n}\t\t\t<\/code> <button>Copy<\/button> Response samples 200 Content type application\/json { &#8220;data&#8221;: { &#8220;id&#8221;: 123, &#8220;status&#8221;: &#8220;active&#8221;, &#8220;url&#8221;: &#8220;https:\/\/www.olx.ro\/oferta\/url.html&#8221;, &#8220;created_at&#8221;: &#8220;2018-02-02 09:35:16&#8221;, &#8220;activated_at&#8221;: &#8220;2018-02-02 09:32:52&#8221;, &#8220;valid_to&#8221;: &#8220;2018-03-04 09:32:52&#8221;, &#8220;title&#8221;: &#8220;This is title&#8221;, &#8220;description&#8221;: &#8220;This is description&#8221;, &#8220;category_id&#8221;: 123, &#8220;advertiser_type&#8221;: &#8220;private&#8221;, &#8220;external_id&#8221;: 12345, &#8220;external_url&#8221;: &#8220;http:\/\/myshop.com\/advert\/123&#8221;, &#8220;contact&#8221;: {}, &#8220;images&#8221;: [], &#8220;price&#8221;: {}, &#8220;salary&#8221;: null, &#8220;attributes&#8221;: [], &#8220;courier&#8221;: null } } Copied to clipboard<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Create advert &nbsp; Validation rules Following characters cannot be provided in the title and in the description three times in a row: !\u00a0?\u00a0.\u00a0,\u00a0&#8211;\u00a0=\u00a0+\u00a0#\u00a0%\u00a0&amp;\u00a0@\u00a0*\u00a0_\u00a0&gt;\u00a0&lt;\u00a0:\u00a0(\u00a0)\u00a0| The amount of capital letters in the title and in the ad description cannot be greater than 50% of a whole text. The title has to be at least 16 characters long&#8230;  <a href=\"https:\/\/doc.olxgroup.com\/api\/?p=971\" title=\"Read Create advert\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[108],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/971"}],"collection":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=971"}],"version-history":[{"count":0,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/971\/revisions"}],"wp:attachment":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}