Documentation
Avito.ma API reference for search, detail and lookups
Reference for the Avito.ma API: how ad search inputs work together, how an ad is identified for detail, and what the category, city and listing fields mean.
See also: Avito.ma API overview and prices · Avito.ma API guide: from category to ad detail
On this page
Avito.ma API categories: rows and languages
avito-ma-categories has one input, body.lang, which picks the language of the printed names. An unrecognised value is ignored and the default applies, and the same rule holds for body.lang on avito-ma-detail, avito-ma-locations and avito-ma-search.
In categories[], category_id is the value that body.category of avito-ma-search expects. The name field is the label in the chosen language and url_slug is the slug Avito uses in its own addresses. The children[] list holds the branches below a node, so the tree is read by descending through it.
The ad_type field classifies a node as sell, let, vac_rent or co_rent. The search_ad_type field is the matching value of body.ad_type, so pair it with category_id when one specific tree is meant.
Fields in this section (2)
avito-ma-categories, body.lang
Detail: identifying the ad by list_id or url
avito-ma-detail identifies an ad through body.list_id, the number that ends an ad address, or through body.url, which takes the short form that ends in .htm as well as the long friendly form. Use body.list_id when a search row already supplied the number.
The names id and ad_id are accepted as alternatives for body.list_id. If a value of body.list_id or body.url is not recognised, it is ignored and the default applies.
Removed or expired ads come back as not found, because the operation detects the search page to which Avito redirects their addresses.
Fields in this section (3)
avito-ma-detail, body.list_id, body.url
Detail: fields inside listing
The listing object keeps Avito's own codes next to the values that search returns. ad_type is SELL, LET, VAC_RENT or CO_RENT, while ad_type_code holds the page's own letter s, u, v or w and ad_type_label holds the readable name. In the same way seller_type is STORE or PRIVATE and seller_type_code holds the page's own shop or private.
phone carries the phone contact as the page publishes it and is null when Avito hides it, and has_hidden_phone shows whether that contact is hidden. price_matches_display shows whether the numeric price agrees with price_display, and old_price with old_price_display carries a previous price.
Each row of attributes[] pairs a label with a value and its display form. The unit, section, code and id fields add the row's unit, its group, its code and its identifier.
The ids behind the printed names are city_id, area_id and category_id, and latitude, longitude and address locate the ad.
Fields in this section (2)
avito-ma-detail, data
Locations: narrowing the city list
body.city narrows avito-ma-locations to one city and its districts. It accepts a slug, a name or an id, and city_id and city_slug work as alternative names. An unrecognised value of body.city is ignored in favour of the default, and leaving the input out returns the whole list.
In each cities[] entry, slug is the value that body.city of avito-ma-search takes. The ad_count field is the number of ads in the city. The areas[] list holds its districts with area_id, name and slug, and the district slug is the value for body.area.
body.lang switches the printed city and district names between French and Arabic.
Fields in this section (3)
avito-ma-locations, body.city, body.lang
Avito.ma API search: keyword, category and ad type
avito-ma-search needs at least one of body.q and body.category. The search spans every vertical of the site, among them phones, cars, apartments, furniture, jobs and services. The keyword is free text matched against ad titles and bodies in French or Arabic, for example iphone, appartement or voiture occasion, and query, keyword and search work as alternative names.
A category is a root such as 1000 or a leaf such as 5010, with category_id as an alternative name. A value of body.q or body.category that is not recognised is ignored and the default applies.
Several property ids are shared by the sale, rent, holiday-rent and flat-share trees. body.ad_type selects among them, and the sale tree is used without it.
For category 1010, rent reaches the 1300 tree, holiday_rent the 1500 tree and shared_rent the 1400 tree, and rent also works on cars, where category 2100 is car rental, and on trucks. The name type works as an alternative, and a value outside the four listed is ignored.
The operation rejects two combinations instead of answering with the wrong ad type:
- a rent, holiday_rent or shared_rent value of
body.ad_typewithout abody.category, since a keyword search that spans categories does not filter by ad type - a
body.categorythat does not exist in the chosen ad type, such as 5010 phones with rent
Fields in this section (4)
avito-ma-search, body.q, body.category, body.ad_type
Search: place, price, seller and paging
body.city accepts a slug or a name with the accents stripped, so Fès becomes fes and Béni Mellal becomes beni_mellal. The names city_slug and ville work as alternatives. A city that Avito does not know is rejected instead of widening the search to the whole country.
body.area is a district of the chosen city and needs body.city; slugs such as maarif or medina_de_rabat come from avito-ma-locations. A body.area value that is not recognised is ignored with the default applying, and area_slug, district and secteur work as alternative names.
body.price_min and body.price_max filter on the price in the currency the ads publish, printed DH for the Moroccan dirham, and either one works alone. body.seller_type restricts the rows to private individuals or to professional sellers and shops, and each row echoes its own seller_type.
body.ad_options takes one of Avito's own ad flags, and ad_option works as an alternative name:
has_price: only ads that publish a pricehas_image: only ads with a photo or a videohotdeal: only ads flagged as a promotionurgent: only ads the seller marked urgent
body.page selects a page of Avito's own result list. Each page holds about 35-38 rows and no input resizes it, and consecutive pages of a changing feed overlap by a row or two. An unrecognised page value falls back to the default.
Fields in this section (8)
avito-ma-search, body.city, body.area, body.price_min, body.price_max, body.seller_type, body.ad_options, body.page
Search: fields inside listings and projects
Each row of listings[] identifies the ad through ad_id, list_id and url. Its place comes from city_id, city, area_id, area and address. The map position comes from latitude and longitude.
The seller object is read in three groups:
seller_id,name,logoandwebsiteidentify and present the sellerregistered_sinceandactive_listings_countdescribe the account's start and its number of active adsis_verified,is_ecommerce,phone_verifiedandphone_contact_typedescribe the seller's status and phone contact
The category_path[] list holds the categories above the ad, each as an id and a name. The phone field holds the phone as the card publishes it, image is a single picture and images[] is the picture list, with image_count giving its size.
Cards in projects[] describe developments. A card's kind and title name it, and its url leads to the project.
The city and area fields place it, and price, price_display and currency give its price. The rooms, bathrooms and size fields carry the room count, the bathroom count and the size, and image shows the development.
Fields in this section (2)
avito-ma-search, data
Operations
Every public gateway operation uses POST /api/v1/{project}/{action}.
Use a JSON object with the documented path, query, headers and body locations; omit unused locations. input.headers is JSON data for the operation, not browser request headers. Do not put credentials here. Keep body arrays, scalar values and null as documented; omission is different from null.
Category tree
POST /api/v1/avito-ma/avito-ma-categories
Lists the Avito.ma category tree with ids, names, ad types and URL slugs, in French or Arabic.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.lang | string | Optional | "fr" | "fr""ar" | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/avito-ma/avito-ma-categories' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"lang":"fr"}}'Ad detail
POST /api/v1/avito-ma/avito-ma-detail
Returns one ad by list_id or ad address: text, price, location, seller, phone, images and attribute rows.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.lang | string | Optional | "fr" | "fr""ar" | — |
body.list_id | string | Optional | — | — | — |
body.url | string | Optional | — | — | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/avito-ma/avito-ma-detail' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"url":"https://www.avito.ma/vi/56251043.htm"}}'Cities and districts
POST /api/v1/avito-ma/avito-ma-locations
Lists Moroccan cities and towns with slugs, ad counts and districts, or narrows the list to one city.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.city | string | Optional | — | — | — |
body.lang | string | Optional | "fr" | "fr""ar" | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/avito-ma/avito-ma-locations' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"city":"casablanca"}}'Ad search
POST /api/v1/avito-ma/avito-ma-search
Searches ads by keyword or category and narrows them by city, district, price, seller type and ad flag.
Input fields
| Field | Type | Required | Default | Allowed values | Limits |
|---|---|---|---|---|---|
body.ad_options | string | Optional | — | "has_price""has_image""hotdeal""urgent" | — |
body.ad_type | string | Optional | "sell" | "sell""rent""holiday_rent""shared_rent" | — |
body.area | string | Optional | — | — | — |
body.category | integer | Optional | — | — | -9007199254740991–9007199254740991 |
body.city | string | Optional | — | — | — |
body.lang | string | Optional | "fr" | "fr""ar" | — |
body.page | integer | Optional | 1 | — | 1–9007199254740991 |
body.price_max | integer | Optional | — | — | 0–9007199254740991 |
body.price_min | integer | Optional | — | — | 0–9007199254740991 |
body.q | string | Optional | — | — | — |
body.seller_type | string | Optional | — | "private""professional" | — |
Request examples
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/avito-ma/avito-ma-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"category":5010,"q":"iphone"}}'How calls work
POST /api/v1/avito-ma/<action>withx-api-key,Content-Type: application/jsonand a requiredIdempotency-Key.- A successful call returns
ok: true:datais the result of the operation,meta.requestIdidentifies the recorded request andmeta.chargedCreditUnitsis the amount charged. Otherwiseokisfalseanderror.codenames the reason; readokanderror.coderather than relying on the HTTP status alone. Every gateway reply carries a request id for support:meta.requestId, or a top-levelrequestIdin a reply withoutmeta(such as a refusal before admission). - Charged the listed price only when a call succeeds. Failures are not charged; an unconfirmed outcome is released after at most 900 seconds without a charge.
- Repeating the same request with the same Idempotency-Key after it has finished returns the stored response for 24 hours without a new charge.
In the gateway reference: