Saved

berape API for partners

Show berape ads on your site and let visitors post ads without leaving your page. All ads go into one shared database; ads posted through your site are credited to you.

Fastest: the widget

Paste these two lines into your page. No programming needed; it picks up your site’s link colour and font.

<script src="https://berape.com/widget/v1.js" defer></script>

<!-- Full marketplace: search, details, WhatsApp chat, post ad, my ads -->
<berape-pasar kunci="pk_…"></berape-pasar>

<!-- Small box, e.g. on the home page or next to articles -->
<berape-terbaru kunci="pk_…" jumlah="4" tautan="/pasar"></berape-terbaru>

Optional attributes: lokasi (postcode or city), radius (km), kategori (slug), warna (e.g. #0a6ebd), sudut (px), bahasa (id, de or en; default: your page’s language), jumlah and tautan (your marketplace page, for <berape-terbaru>). Without lokasi, the widget uses your partner default location.

WordPress

WordPress site: install the berape Pasar plugin (Plugins → Add New → Upload Plugin), enter the public key under Settings → berape Pasar, then write [berape_pasar] on a new page. Latest-ads box: [berape_terbaru jumlah="4" tautan="/pasar"] or the Latest berape ads widget.

Keys

  • Public key (pk_…): may appear on web pages. Only works from registered domains (Origin header).
  • Secret key (sk_…): for your server only. No domain restriction, also for statistics.

Send the key in the X-Berape-Kunci header. You get your keys in the partner dashboard after registering and verifying your domain.

Base URL

https://api.berape.com/v1, responses are always JSON. Errors: {"galat": "…"} with HTTP status 4xx/5xx.

Language

Add ?bahasa=de or ?bahasa=en to get category names and error messages in German or English. The original message stays in galatAsli. Ad content is always as written by the seller. API field names are Indonesian (e.g. judul = title, harga = price).

Endpoint

GET/v1Check key, partner info
GET/v1/kategoriCategories and subcategories (slugs are used for searching and posting)
GET/v1/lokasi?q=294Postcode, city, district and village suggestions while typing
GET/v1/lokasi?kp=29432Villages with this postcode (id → field desa)
GET/v1/iklan?q=&kategori=&lokasi=&radius=&min=&maks=&urut=&hal=Search ads. Without lokasi: the partner’s default location; lokasi=semua for all of Indonesia
GET/v1/iklan/{id}Ad details (your own ads also before approval, with token)
POST/v1/iklan/{id}/kontakWhatsApp link to the seller (counted as a click)
POST/v1/iklan/{id}/laporanReport an ad: {"alasan": "penipuan|terlarang|spam|salah|terjual|lainnya"}
POST/v1/masuk/kodeSend a login code to the seller’s WhatsApp: {"nomor": "0812…"}
POST/v1/masuk/verifikasi{"nomor", "kode"} → {"token"} (90 days)
POST/v1/masuk/pesanLog in by sending a WhatsApp message (when GET /v1 returns "masuk": "pesan"): → {"id", "rahasia", "waUrl", "teks"}
POST/v1/masuk/pesan/cek{"id", "rahasia"} → {"status": "menunggu"} … {"status": "masuk", "token"}. Poll every 2–3 seconds.
GET/v1/sayaSeller data and their ads (token)
POST/v1/iklanPost an ad, multipart (token)
POST/v1/iklan/{id}Edit your own ad, multipart (token)
POST/v1/iklan/{id}/aksi{"aksi": "terjual|perpanjang|hapus"} (token)
GET/v1/statistikAds posted through your site (secret key)

Example: latest ads around your city

const r = await fetch('https://api.berape.com/v1/iklan?lokasi=batam&radius=20', {
  headers: { 'X-Berape-Kunci': 'pk_…' },
})
const { iklan } = await r.json()
// iklan[0].judul (title), .harga (price), .foto[0].kecil, .lokasi.teks, .urlKanonik

Example: seller logs in and posts an ad

// 1. Code to the seller’s WhatsApp
await fetch('https://api.berape.com/v1/masuk/kode', { method: 'POST', headers, body: JSON.stringify({ nomor: '0812…' }) })
// 2. Seller types the code → token
const { token } = await (await fetch('https://api.berape.com/v1/masuk/verifikasi', {
  method: 'POST', headers, body: JSON.stringify({ nomor: '0812…', kode: '123456' }),
})).json()
// 3. Post the ad (multipart): judul, deskripsi, harga, nego, kondisi, kategori (slug),
//    desa (id from /lokasi?kp=), nama, foto (1–8 JPG/PNG/WebP files)
const f = new FormData()
f.append('judul', 'Honda Beat 2019'); f.append('kategori', 'motor'); f.append('desa', '44754')
f.append('foto', fileInput.files[0])
await fetch('https://api.berape.com/v1/iklan', {
  method: 'POST', headers: { 'X-Berape-Kunci': 'pk_…', Authorization: 'Bearer ' + token }, body: f,
})

Rules

  • Ads from new sellers are moderated first; the response contains "tayang": false.
  • The seller’s WhatsApp number is never sent; use /kontak for the chat link.
  • Link every ad to urlKanonik (the original page on berape.com) so Google doesn’t see duplicate content.
  • Request limit per key per minute depends on the plan; above it → HTTP 429.