Create advert
Validation rules
- Following characters cannot be provided in the title and in the description three times in a row: ! ? . , - = + # % & @ * _ > < : ( ) |
- 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 and cannot be longer than 70 characters.
- The description has to be at least 80 characters long and cannot be longer than 9000 characters.
- E-mail addresses and phone numbers are not allowed in the title and in the description.
- Salary currency has to be written in uppercase (for example: EUR
instead of eur). - Lower or upper value of the salary cannot be greater than 99999999999999.
Advert lifecycle
- Post new advert
- In response you will get current status of posted advert:
- if status is limited then you must buy packet for advert or category and activate advert (check out Packets section and Adverts section)
- if status is new then flow goes to point 3.
- Advert is awaiting for moderation. Usually it takes some seconds.
- if advert is accepted it will be activated automatically and visible for all users
- if advert is rejected (possible reasons: scam, illegal items offered etc)
- if advert is rejected but user can fix issues, and advert goes back to moderation
- Advert is active. How long advert will be valid is defined in field valid_to in advert response.
- When “valid to” date is passed, advert becomes outdated - user can activate advert again.
User can manually deactivate advert, status is set to removed_by_user. Deactivated advert can be activated again. To completly remove advert user should deactivate it at first and then delete it (check out Adverts section).
Advert statuses
- new: fresh advert before activation and moderation
- active: visible on OLX
- limited: advert exceeded limit of free adverts in selected category
- removed_by_user: manually removed by user
- outdated: advert reached expiration date
- unconfirmed: waiting for confirmation
- unpaid: waiting for payment
- moderated: negative moderation result
- blocked: blocked by moderation
- disabled: disabled by moderation, offer blocked and waiting for verification
- removed_by_moderator: removed by moderator
Posting Advert
To add an advert client have to send request to /api/partner/adverts endpoint.
This endpoint requires POST HTTP method, and expects data to be sent as JSON along with Content-Type: application/json header.
Remember to send Authorization: Bearer ACCESS_TOKEN and Version: 2.0 headers either.
Using this endpoint creates advert in the name of currently authenticated user.
You must send all required fields (as it’s described in /api/partner/adverts endpoint reference), inlcuding required attributes.
For list of available categories, attributes, cities please check out appropriate endpoint references like /api/partner/categories, /api/partner/cities and so on.
You can get list of required attributes by /api/partner/categories/ID/attributes endpoint where ID is the category ID you choosed. Endpoint return list of required and optional attributes to create advert - attributes vary in different countries and categories.
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.
When some required fields are missing in response you will get a list of errors as a result:
Copied to clipboard
API will return full advert model if request succeded:
Copied to clipboard
If status is new, it’s mean that advert will be activated soon (after moderation process). But if status is limited you must perform two extra steps:
- buy “packet” for a single advert (check out /api/partner/adverts/ID/packets) or whole category (check out /api/partner/users/me/packets).
- activate advert (checkout /api/partner/adverts/ID/commands - activate command)
After some time (usually few seconds) advert should become active and be visible to all users.
You can deactivate active advert with deactivate command (checkout /api/partner/adverts/ID/commands). You can activate inactive advert with activate command.
If you want to completely remove advert please use DEL /api/partner/adverts/ID/ endpoint.
You can buy extra paid features for active advert. For more details check out “Paid features” section.
AUTHORIZATIONS: access_token
REQUEST BODY SCHEMA: application/json
| title
required
|
string
|
| description
required
|
string
May contain html tags (only in Jobs category) <ul><li><strong><em><p> |
| category_id
required
|
integer
|
| advertiser_type
required
|
string
Enum: "private" "business"
|
| external_url |
string
Advert's URL in origin system |
| external_id |
string
Advert's ID in origin system |
|
required
|
object
|
|
required
|
object
|
|
Array of objects
|
|
|
object
Used by most of the categories, i.e. cars, houses, clothes, etc. Required by most of the mentioned categories. |
|
|
object
Used by some of the categories, i.e. jobs. Required by most of the mentioned categories. |
|
|
required
|
Array of objects
|
| courier |
boolean
Is delivery possible. If true that means that delivery is possible. (Available in BG, KZ, PT, RO). |
Responses
Status 200
OLX Production Server
POST
/adverts
Request samples
Payload
Content type
application/json
{
"title": "string",
"description": "string",
"category_id": 0,
"advertiser_type": "private",
"external_url": "string",
"external_id": "string",
"contact": {
"name": "string",
"phone": "string"
},
"location": {
"city_id": 0,
"district_id": 0,
"latitude": 0,
"longitude": 0
},
"images": [
{}
],
"price": {
"value": 0,
"currency": "string",
"negotiable": true,
"trade": true,
"budget": true
},
"salary": {
"value_from": 0,
"value_to": 0,
"currency": "string",
"negotiable": true,
"type": "hourly"
},
"attributes": [
{}
],
"courier": true
}
Copied to clipboard
Response samples
200
Content type
application/json
{
"data": {
"id": 123,
"status": "active",
"url": "https://www.olx.ro/oferta/url.html",
"created_at": "2018-02-02 09:35:16",
"activated_at": "2018-02-02 09:32:52",
"valid_to": "2018-03-04 09:32:52",
"title": "This is title",
"description": "This is description",
"category_id": 123,
"advertiser_type": "private",
"external_id": 12345,
"external_url": "http://myshop.com/advert/123",
"contact": {},
"images": [],
"price": {},
"salary": null,
"attributes": [],
"courier": null
}
}
Copied to clipboard