The Oki Business API connects your own system (customer portal, billing software, SMS infrastructure, CRM, bot) to Oki.
You send notifications, verification codes, approval requests and messages with buttons to your customers in their chat with you in the Oki app;
you import your customer list, manage your inbox with a bot, and receive events via signed webhooks.
NotificationsInvoices, payment reminders, installation results (transactional), or campaigns and content digests (announcement).
Verification codesInstead of SMS: Oki generates the code, the customer taps "Copy code", and you check it with a single endpoint.
Approval requestsAn "Approve / Decline" card; the customer's decision arrives instantly via webhook, and the card closes when it expires.
Messages with buttonsOpen a URL, call back to your system, place a call, copy text; up to 10 buttons.
Customer listBulk import with your own IDs, fields, tags; shown on the customer card in the dashboard.
Inbox and botsList, reply to (including the web support widget), assign and close conversations.
WebhooksLinked, delivered, read, customer wrote, button tapped, approval decision… Signed with HMAC-SHA256.
No middleman. No per-message fees. Oki Business comes with a single monthly subscription:
the API, a multi-agent inbox, bots, channels, button and bulk messages, approval requests and verification codes are all in the same plan.
The number of notifications, announcements, replies or verification codes you send does not change your bill; there are only
fair-use limits that prevent abuse. No middleman (partner, panel provider) is needed: take your key from the panel and
connect directly.
The table below shows features that work in Oki today. The other two columns roughly summarize how you get the same feature there.
Feature
Oki Business API
WhatsApp Business Platform
Telegram Bot API
Pricing
✓ One monthly subscription; no per-message fees (verification codes included)
Per-message pricing since 1 July 2025: marketing, utility and authentication messages are charged; service replies within 24 hours of the customer's message are free. Prices vary by country
Bot API is free; verification codes are a separate product (Gateway) charged per code
Connect without a middleman
✓ Key from the panel, direct
Mostly through a partner (BSP) and its panel
✓ Direct (bot token)
Reach by phone number
✓ To a phone verified in Oki
✓
No (the user must start the bot first)
Business-initiated notifications
✓ With type islem / duyuru, no template approval needed
Outside the 24-hour window, an approved template is required
✓ (interactive list message; location request message)
No list (built with inline buttons); location request keyboard button (request_location)
Buttons (URL, callback, phone, copy)
✓ up to 10, all in one message
✓ (type and number depend on the template / interactive message type)
✓ (URL, callback, copy)
Edit / unsend a sent message
✓
Not in the Cloud API docs
✓
Customer list, custom fields, tags
✓ API + dashboard
Not in the API (your own CRM or a partner product)
No
Inbox, agent assignment, web support widget
✓ in the same API
Not in the API (partner products)
No
Customers can turn off promotional / announcement messages
✓ per business
✓ (“Offers and announcements” setting)
By stopping / blocking the bot
No announcements at night (enforced by the server)
✓ 08:00–21:00
—
—
The WhatsApp and Telegram columns are a rough summary based on those products' public documentation as of 29 October 2026 (pricing rows: 31 October 2026; list / location row: 8 November 2026); those products may change. For authoritative information, see their own documentation.
This document is version v2 (29 October 2026). v1 endpoints keep working unchanged; for the differences, see the Changelog.
In okime.com/web, in the Business area, go to Settings → API and integrations → New key. Give the key a name (e.g. "Billing system").
The key starts with okb_ and is shown only once. Store it on your server in a secret config file or an environment variable; do not put it in code or a repository, and never ship it in a browser or mobile app.
If it is lost or leaked, delete it in the dashboard and create a new one. A business can have at most 10 keys; the dashboard shows the first characters and last-used time of each key.
The PHP, Node.js and Python examples in this document use the small helper below: it returns an [HTTP status, response] pair.
In the cURL examples, the key is in the $OKI_API_ANAHTARI environment variable.
On a network error or a 5xx response, resend the request with the same istemciKimligi; the second request does not create a new message (see safe retries).
In your system, a customer is identified by disKimlik (external ID): the customer number, subscriber code or email address in your own database.
1–128 characters; letters, digits and . _ : @ -. Oki never changes this value; it comes back to you as is in webhooks, the customer list and conversations.
A customer card gets a disKimlik in one of three ways: customer import (POST /musteriler),
account linking (with the customer's consent), or the first message sent with both disKimlik and telefon.
In the message, approval and verification endpoints, you specify the recipient with one of these fields:
Field
Goes to
Details
disKimlik
The customer card with this ID
If the card has an Oki account (linked, or previously matched by phone), directly to it. If it has no account but you supplied a telefon in the import, that phone is tried. If neither, bagli_degil.
telefon
The user who verified this phone in Oki
With country code, digits only (E.164; + and spaces are stripped; for Turkey, 05321234567 also works). The customer does not need to be linked. If there is no Oki user with this phone, oki_yok: fall back to SMS. The customer's Oki number is not shown to you; until the customer writes or replies to you it is not shown on their card either, and agents cannot write to that conversation from the panel (only API notifications are delivered). The number of distinct phones you have never exchanged messages with is limited per day (see Limits).
konusma
The customer in this conversation
The conversation ID from the mesaj webhook or from GET /konusmalar. Also covers visitors writing from the web support widget.
If disKimlik and telefon are given together: if the card exists, the card is used; if it has no Oki account, the account found by phone is attached to the card. If there is no card, this ID is written to the customer found by phone (unless their card already has a different ID).
If konusma is given, disKimlik and telefon are ignored.
For a customer reached by phone who has never chatted with you, Oki opens a customer card; the conversation starts out closed and does not fill up your inbox. When the customer replies, the conversation opens.
The customer is always in control. In their chat with you, the customer can block the business (engelli), remove the link (kaldirdi) and turn off announcements (duyuru_kapali). In these cases the request returns 409; for linked customers, the change is also reported via webhook.
Sent at any hour. 30 per customer per hour. This is the default type.
duyuru
Campaigns, content digests, reminders to inactive customers, newsletters.
Only to customers who have written or replied to your business (403 iliski_yok otherwise). Only 08:00–21:00 (Turkey time). 3 per customer per day, 20,000 per business per day. Customers can turn them off.
reply
A reply in a conversation the customer started (bot, auto-reply).
With POST /konusmalar/{id}/mesaj, or with POST /mesaj when you give konusma and no tur. No per-customer limit if the customer wrote within the last 72 hours; otherwise it counts as a transactional notification (30 per hour per customer). Marks the conversation as read and moves it to the top of the inbox.
Do not use the islem type for ads or campaigns. Abuse leads to customers blocking you and to the business account being suspended.
istemciKimligi (client ID) is required on message and approval requests (optional for verification codes): a unique value you generate, 8–64 characters (letters, digits, _ -).
A second request with the same value does not send a new message; it returns the original message with "tekrar": true. This lets you safely repeat a request after a timeout, a dropped connection or a 5xx.
Good examples: fatura-991-hatirlatma-1, otp-12345-1730192400, or a UUID you store for each send. The value must be unique within your business; do not reuse the same value for different messages.
1,000 distinct numbers per day (customers who already have a card are not counted). For high-volume accounts such as verification-code providers this limit is raised per account; message Oki Business.
429 telefon_siniri
API requests (per business)
600 per minute
429 hiz_siniri (with a Retry-After header)
Media upload URLs (per business)
300 per hour
429 sinir
Bulk messages
100 per request
400 mesajlar
Customer import
500 per request
400 musteriler
Counters use a sliding window (last 1 minute / 1 hour / 10 minutes / 1 day). When you get sinir, retry after a while, or fall back to SMS for urgent transactional notifications.
The body of an error response is always JSON: a human-readable hata and a machine-readable kod. When a message cannot be sent, a neden is also included.
A message lands in the customer's chat with you in Oki and shows up as a notification (unless you set sessiz).
You can send text, a photo or a document and add up to 10 buttons; you can later edit or recall a message you sent.
istemciKimligi is missing or has an invalid format.
400
tur
tur is not islem or duyuru.
400
metin
Neither text nor media is given, or the text exceeds 4096 characters.
400
dugmeler
Does not follow the button rules (name, type or the type's field).
400
medya
nesne or tur is invalid.
400
alici
None of disKimlik, telefon or konusma is given.
400
dis_kimlik
disKimlik has an invalid format.
400
telefon
The phone number is not written with a country code.
404
konusma
Conversation not found.
409
ulasilamadi
Could not be sent; check the neden field: bagli_degil, oki_yok, engelli, kaldirdi, duyuru_kapali, sinir, saat.
403
iliski_yok
tur: duyuru was sent to a customer who has not yet written or replied to your business (found by phone number only). Promotional messages are not delivered; an islem notification is.
429
telefon_siniri
Today's limit of new numbers (ones you have never exchanged messages with) reached by phone is used up.
429
hiz_siniri
The per-minute API request limit was exceeded (applies to every endpoint).
503
telefon_kapali
Sending by phone number is temporarily unavailable.
An announcement outside allowed hours (neden: saat) or to a customer who has turned announcements off (duyuru_kapali) is not sent at all; it is not queued. Send it again within allowed hours.
Announcements (promotional messages) only go to customers you have a conversation with. If you found the customer by phone number only and the customer has not yet written to your business, has not replied to your message (tapping a button or confirming also counts as a reply) or has not approved a link request, tur: duyuru is rejected with 403 iliski_yok; no message is written and no customer card is opened. Transactional types (islem, confirmation cards, verification codes, appointments, orders) are not affected. Addressing the recipient later by disKimlik or konusma does not change the result; the relationship starts with the customer's first message or reply.
Each object in the dugmeler array has an ad (1–24 characters, the label shown on the button) and a tur. If tur is omitted, it defaults to adres; fields that do not belong to the type are dropped.
tur
What happens for the customer
Required field
adres (default)
The URL opens in the browser.
adres: starts with https://, up to 512 characters
geri
A dugme webhook is sent to your system; the chosen button is marked in the message.
veri: 1–64 characters (ASCII). Returned unchanged in the webhook; e.g. siparis:5521:iptal
telefon
The phone app calls this number.
numara: 3–20 digits, may start with +
kopyala
The text is copied to the clipboard (code, IBAN, coupon).
metin: 1–128 characters
uygulama
The mini app URL opens inside Oki with a signed customer identity (okiGiris).
adres: starts with https://, up to 512 characters
konum
After the customer confirms, their current location is sent to you with one tap: a tur: "konum" message lands in the conversation (icerik.enlem, icerik.boylam, icerik.dogruluk in metres, icerik.istek the id of the message with the button) and you receive the mesaj webhook.
—
takvim
The event is added to the phone's calendar (an .ics file opens in the calendar app).
takvim: baslik (1–120), bas (RFC 3339 time), bit? (default 1 hour), yer? (up to 200), aciklama? (up to 500)
Callback example: A courier company sends the buttons "Postpone delivery to tomorrow" and "Leave at the door"; when the customer taps one, your system receives
{"dugme": {"sira": 1, "ad": "Leave at the door", "veri": "kargo:7731:kapi"}}. While tekSecim is on, the customer cannot choose a second time;
to finalize the choice you can edit the message, remove the buttons and write "Will be left at the door ✓".
With liste you send the customer a list of options. When the customer taps the button in the message (dugme; "Choose" if omitted) the options open; when they pick one, the choice lands in the conversation as the customer's reply and your system receives the mesaj webhook (icerik.listeYaniti: mesaj, sira, ad, veri). It is single-choice; a second tap is not possible.
Field
Rule
liste.baslik
Optional, up to 60 characters; title of the opened list.
liste.dugme
Optional, up to 24 characters; text of the button that opens the list.
liste.secenekler
2–10 options. Each has ad (1–48), aciklama? (up to 72), veri? (1–64 ASCII, unique; defaults to the position number).
A customer on an older Oki version cannot see the list or the new button types (konum, takvim). So the server appends a fallback text to the end of the message text and also writes it to icerik.yedek; newer versions hide this part. The list is written as numbered lines plus "type a number between 1 and 3" (in Turkish), the location button as "you can reply by typing your address", the calendar button as the event name, time (Turkey time) and place. A customer on an older version replies by typing the number: in that case the mesaj webhook has no icerik.listeYaniti and icerik.metin is a digit such as "2".
1–100 messages in a single request. Each message is the same as a POST /mesaj body and is processed separately: if one cannot be sent, the others still go out. Each message must have its own istemciKimligi. The body may be up to 4 MB.
Request fields
Field
Type
Required
Description
mesajlar
array
required
An array of POST /mesaj bodies (1–100).
Example request
curl -X POST "https://okime.com/v1/api/mesaj/toplu" \
-H "Authorization: Bearer $OKI_API_ANAHTARI" \
-H "Content-Type: application/json" \
-d '{
"mesajlar": [
{
"disKimlik": "12345",
"tur": "duyuru",
"metin": "November campaign is live: 20% off the first month.",
"istemciKimligi": "kampanya-kasim-12345"
},
{
"telefon": "905321234567",
"tur": "duyuru",
"metin": "November campaign is live: 20% off the first month.",
"istemciKimligi": "kampanya-kasim-905321234567"
}
]
}'
[$kod, $c] = oki('POST', '/mesaj/toplu', [
'mesajlar' => [
[
'disKimlik' => '12345',
'tur' => 'duyuru',
'metin' => 'November campaign is live: 20% off the first month.',
'istemciKimligi' => 'kampanya-kasim-12345',
],
[
'telefon' => '905321234567',
'tur' => 'duyuru',
'metin' => 'November campaign is live: 20% off the first month.',
'istemciKimligi' => 'kampanya-kasim-905321234567',
],
],
]);
const [kod, c] = await oki('POST', '/mesaj/toplu', {
mesajlar: [
{
disKimlik: '12345',
tur: 'duyuru',
metin: 'November campaign is live: 20% off the first month.',
istemciKimligi: 'kampanya-kasim-12345',
},
{
telefon: '905321234567',
tur: 'duyuru',
metin: 'November campaign is live: 20% off the first month.',
istemciKimligi: 'kampanya-kasim-905321234567',
},
],
});
kod, c = oki("POST", "/mesaj/toplu", {
"mesajlar": [
{
"disKimlik": "12345",
"tur": "duyuru",
"metin": "November campaign is live: 20% off the first month.",
"istemciKimligi": "kampanya-kasim-12345",
},
{
"telefon": "905321234567",
"tur": "duyuru",
"metin": "November campaign is live: 20% off the first month.",
"istemciKimligi": "kampanya-kasim-905321234567",
},
],
})
The response is always 200; each message's result comes in sonuclar, in the order you sent them (sira) and with its own httpKodu. For hundreds of thousands of recipients, send requests one after another; the business limit is 300 messages per minute.
Delivery status of a message sent via the API: gonderildi (reached Oki), iletildi (reached the customer's phone) or okundu (read). Status changes also arrive as iletildi / okundu webhooks.
Example request
curl -X GET "https://okime.com/v1/api/mesaj/99812" \
-H "Authorization: Bearer $OKI_API_ANAHTARI"
Changes the text and/or buttons of a message you sent via the API. The message is updated in place in the customer's chat and marked as "edited"; no new notification is shown. Fields you omit stay unchanged.
Request fields
Field
Type
Required
Description
metin
string
optional
New text (up to 4096). Cannot be empty in a message without media.
dugmeler
array
optional
New buttons; [] removes all buttons. When the buttons change, the customer's previous choice is cleared.
Recalls the message from the customer's chat: the content is deleted and a "recalled" marker remains in its place. Also returns 200 for a message that was already recalled (safe to repeat). To close a pending approval request, use DELETE /onay/{id}.
Media is sent in two steps: first you get an upload URL with POST /medya and PUT the file to that URL,
then pass it in the message as medya.nesne. The upload URL is valid for 15 minutes. An upload not used in a message is deleted after 1 day; a file attached to a message is kept for 30 days, and only files uploaded by your own business can be used. The same file can be used in several messages (e.g. the same document in a bulk send).
Send the file to yukleme.url with PUT, adding the headers from yukleme.basliklarexactly as given (do not add Authorization to this request). Then send the message:
$dosya = __DIR__ . '/fatura-991.pdf';
[$kod, $m] = oki('POST', '/medya', ['boyut' => filesize($dosya), 'tur' => 'belge']);
// 1) PUT the file to the upload URL (headers exactly as given).$basliklar = [];
foreach ($m['yukleme']['basliklar'] ?? [] as$ad => $deger) {
$basliklar[] = "$ad: $deger";
}
$c = curl_init($m['yukleme']['url']);
curl_setopt_array($c, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => file_get_contents($dosya),
CURLOPT_HTTPHEADER => $basliklar,
CURLOPT_RETURNTRANSFER => true,
]);
curl_exec($c);
if (curl_getinfo($c, CURLINFO_RESPONSE_CODE) >= 300) {
thrownew RuntimeException('upload failed');
}
// 2) Use it in a message.
[$kod, $c] = oki('POST', '/mesaj', [
'disKimlik' => '12345',
'metin' => 'Your October invoice is attached.',
'medya' => ['nesne' => $m['nesne'], 'tur' => 'belge', 'ad' => 'October invoice.pdf'],
'istemciKimligi' => 'fatura-991-pdf',
]);
import { readFile } from'node:fs/promises';
const veri = await readFile('fatura-991.pdf');
const [, m] = await oki('POST', '/medya', { boyut: veri.length, tur: 'belge' });
// 1) PUT the file to the upload URL (headers exactly as given).const y = await fetch(m.yukleme.url, { method: 'PUT', headers: m.yukleme.basliklar ?? {}, body: veri });
if (!y.ok) thrownew Error('upload failed: ' + y.status);
// 2) Use it in a message.const [kod, c] = await oki('POST', '/mesaj', {
disKimlik: '12345',
metin: 'Your October invoice is attached.',
medya: { nesne: m.nesne, tur: 'belge', ad: 'October invoice.pdf' },
istemciKimligi: 'fatura-991-pdf',
});
from pathlib import Path
veri = Path("fatura-991.pdf").read_bytes()
_, m = oki("POST", "/medya", {"boyut": len(veri), "tur": "belge"})
# 1) PUT the file to the upload URL (headers exactly as given).
y = requests.put(m["yukleme"]["url"], data=veri, headers=m["yukleme"].get("basliklar") or {}, timeout=60)
y.raise_for_status()
# 2) Use it in a message.
kod, c = oki("POST", "/mesaj", {
"disKimlik": "12345",
"metin": "Your October invoice is attached.",
"medya": {"nesne": m["nesne"], "tur": "belge", "ad": "October invoice.pdf"},
"istemciKimligi": "fatura-991-pdf",
})
# 1) upload URLcurl -X POST "https://okime.com/v1/api/medya" \
-H "Authorization: Bearer $OKI_API_ANAHTARI" \
-H "Content-Type: application/json" \
-d '{"boyut": 482133, "tur": "belge"}'# 2) upload the file (url and headers from the response)curl -X PUT "<yukleme.url>" -H "Content-Length: 482133" --data-binary @fatura-991.pdf
# 3) messagecurl -X POST "https://okime.com/v1/api/mesaj" \
-H "Authorization: Bearer $OKI_API_ANAHTARI" \
-H "Content-Type: application/json" \
-d '{"disKimlik": "12345", "metin": "Your October invoice is attached.",
"medya": {"nesne": "9f2c4e1a7b3d4c5e8f6a0b1c2d3e4f50", "tur": "belge", "ad": "October invoice.pdf"},
"istemciKimligi": "fatura-991-pdf"}'
An approval request sends a card with Approve / Decline buttons to the customer's chat. The customer decides once; the decision arrives instantly
via the onay webhook. If it expires, the card closes and a webhook is sent as well.
Example scenario — SMS provider: Before sending a campaign its customer has prepared, Example SMS Inc. asks for approval:
"Your campaign with sender name ORNEKMARKA is ready to go to 12,500 recipients." The customer taps Approve in Oki; the SMS dashboard
starts sending when it receives the webhook. If they decline, the campaign stays a draft; if there is no answer within 30 minutes, the request closes on its own.
The card goes only to a customer in the Oki app (it can't be sent to a visitor in the web support widget). You can send up to 30 approval requests per customer per hour (counted separately from transactional notifications); the announcement-hours restriction doesn't apply.
Closes a pending request; the customer's card shows "cancelled" and its buttons stop working. For a request that has already been decided or has expired, you get 409 with the current durum.
Send verification codes for sign-in, sign-up or payment confirmation from Oki instead of SMS. Oki generates the code (or you provide it);
the customer sees the code and a Copy code button in their chat. You check the code the user enters with a single endpoint: expiry, attempt count
and single use are tracked by Oki. When you send by phone number, the customer doesn't need to be linked to you.
The message the customer sees
Your Example SMS verification code: 482913
Do not share this code with anyone; Example SMS Inc. staff will never ask you for it.
[ Copy code ]
Checks the code the user entered. At most 5 attempts; a correct code can be used only once (it is marked "used" in the customer's message). Always decide based on the gecerli field.
// 1) Send the codeconst [kod, c] = await oki('POST', '/dogrulama', {
telefon, // e.g. '905321234567'
uygulama: 'Example SMS',
istemciKimligi: `giris-${oturum.id}`,
});
if (kod === 200) {
oturum.okiDogrulama = c.dogrulama; // "We sent the code to Oki"
} else {
await smsIleKodGonder(telefon); // oki_yok, engelli, sinir… → SMS
}
// 2) When the user enters the codeconst [k2, s] = await oki('POST', `/dogrulama/${oturum.okiDogrulama}/kontrol`, { kod: girilenKod });
if (k2 === 200 && s.gecerli) {
// sign-in complete
} elseif (s.durum === 'yanlis') {
// `Wrong code. Attempts left: ${s.kalanDeneme}`
}
# 1) Send the code
kod, c = oki("POST", "/dogrulama", {
"telefon": telefon, # e.g. "905321234567""uygulama": "Example SMS",
"istemciKimligi": f"giris-{oturum_id}",
})
if kod == 200:
oturum["oki_dogrulama"] = c["dogrulama"] # "We sent the code to Oki"else:
sms_ile_kod_gonder(telefon) # oki_yok, engelli, sinir… → SMS# 2) When the user enters the code
k2, s = oki("POST", f"/dogrulama/{oturum['oki_dogrulama']}/kontrol", {"kod": girilen_kod})
if k2 == 200and s["gecerli"]:
pass # sign-in completeelif s.get("durum") == "yanlis":
uyari = f"Wrong code. Attempts left: {s['kalanDeneme']}"
Optionally, wait for the iletildi webhook for the code message: for example, if it doesn't arrive within 20 seconds, make the SMS option more prominent for the user. The mesaj in the webhook is the same as the mesaj in the POST /dogrulama response.
Import your customer list into Oki Business: each customer, identified by your disKimlik, becomes a customer card; your agents see the fields
and tags in the dashboard, and you send messages by disKimlik. Fields you omit stay unchanged; a second import with the same ID updates the card.
1–500 customers per request (body at most 8 MB; send larger lists in batches). Each customer is written separately: if one fails, the others are still saved.
Request fields
Field
Type
Required
Description
musteriler
array
required
Customer objects; disKimlik is required in each, other fields below.
alanOlustur
boolean
optional
true: an undefined field is created automatically (its type is inferred from the value). false (default): an unknown field is an error for that customer.
musteriler[].disKimlik
string
required
Your customer ID.
musteriler[].ad
string
optional
Display name, at most 64 characters.
musteriler[].telefon
string
optional
With country code (e.g. 905321234567); stored in the telefon field as +905321234567. If an Oki user has verified this phone number, the card is matched to their account on the first message.
musteriler[].eposta
string
optional
Stored in the eposta field.
musteriler[].alanlar
object
optional
Key → value (at most 100). The value must match the field's type; an empty value ("" or null) clears the field.
musteriler[].etiketler
string[]
optional
Replaces all tags with this list (each at most 30 characters, at most 20 tags).
Per-customer errors are returned in sonuclar with "durum": "hata" and a hata message (e.g. invalid disKimlik, unknown field, value not matching the type, required field left empty).
Automatic field creation
The telefon and eposta fields are created automatically even without alanOlustur (types telefon / eposta).
With alanOlustur: true, a new field's key must start with a lowercase letter and contain only a-z 0-9 _ (at most 40). The display name is generated from the key: son_odeme → "Son odeme" (you can change it in the dashboard).
The type is inferred from the value: number → sayi, true/false → evet_hayir, YYYY-AA-GG → tarih, text longer than 500 characters → uzun_metin, everything else → metin. For a choice or currency field, define it first with POST /alanlar.
Card merging
A card you import is not yet attached to an Oki account. The first time you reach a customer who has verified that phone number on Oki by phone (or via the card's telefon field), the card is attached to that account.
If the customer already has a card with you (you have chatted before), the two cards merge: fields and tags move to the account's card, and your disKimlik is kept.
Customers that have a disKimlik, in the order they were added. To paginate, send the sonraki value from the response as the sonra parameter; sonraki: null means the last page.
Query parameters
Field
Type
Required
Description
etiket
string
optional
Only customers with this tag.
ara
string
optional
Searches names, disKimlik and field values (case-insensitive).
sonra
integer
optional
The sonraki value from the previous response.
sinir
integer
optional
Page size, 1–500 (default 100).
Example request
curl -X GET "https://okime.com/v1/api/musteriler?etiket=vip&sinir=100" \
-H "Authorization: Bearer $OKI_API_ANAHTARI"
Updates a single customer (404 if it does not exist; use POST /musteriler to add). The body is the same as the customer object in an import (disKimlik is taken from the path); you can also pass alanOlustur. The response is the updated customer.
Request fields
Field
Type
Required
Description
ad
string
optional
Display name, at most 64 characters.
telefon
string
optional
With country code (e.g. 905321234567); stored in the telefon field as +905321234567. If an Oki user has verified this phone number, the card is matched to their account on the first message.
eposta
string
optional
Stored in the eposta field.
alanlar
object
optional
Key → value (at most 100). The value must match the field's type; an empty value ("" or null) clears the field.
etiketler
string[]
optional
Replaces all tags with this list (each at most 30 characters, at most 20 tags).
A card with no Oki account and no conversation (import only) is deleted: "durum": "silindi". If the customer has chatted with you or has been matched to an Oki account, the card is not deleted; the data you imported is cleared (fields, tags, disKimlik and the link): "durum": "temizlendi". The conversation history stays with your business.
With the customer's explicit consent, account linking maps their account in your system (disKimlik) to their Oki account.
In v2, linking is not required to send messages (you can send by phone or to an imported card); linking is used to get the customer's "this account is mine"
confirmation, map the identity permanently, and receive preference changes (duyuru_kapatildi, baglanti_kaldirildi) via webhook.
API responses never include the Oki number or phone; only the "linked" status and your own disKimlik are returned. Once a customer writes to you in Oki or replies to your message, their Oki number is shown on the customer card in the panel; in an IVR query the request also carries the Oki number of the customer calling you.
If an account has verified this phone in Oki, a confirmation card appears in the customer's chat with you in Oki: "… wants to link your account — Link / No".
The response is always the same:202 {"durum": "bekliyor"}. Whether the number is on Oki is not reflected in the response.
If the customer approves, you immediately get the baglandi webhook.
If not approved (no account / declined / no answer), after 24 hours you get baglanmadi — all three cases look the same.
If someone whose phone is not on Oki yet installs Oki and verifies this phone within 30 days, the card appears then; if they approve, baglandi arrives (even if 24 hours have passed).
If the customer is already linked with this ID, the response is 200 {"durum": "baglandi"}, plus a baglandi webhook.
A new request for the same customer within 24 hours returns the same istek ID; no second card appears. A customer who declined is not asked again for 90 days (the request is accepted but not shown; baglanmadi after 24 hours). No card is sent to a customer who has blocked you.
#B — If the customer is already writing to you from Oki
konusma: the conversation ID from the mesaj webhook. The card lands directly in that customer's chat.
If telefon is also given, it must match the phone the customer verified in Oki; otherwise the card says "verify this phone in Oki first" (Oki runs its own SMS verification), and once verified the customer can approve.
If telefon is not given, linking happens on the customer's approval alone.
For now: phone verification in Oki is only available for Turkish mobile numbers. Customers abroad cannot be found by phone; use path B without a phone (the customer writes to you from Oki, you verify their identity and send the request with konusma).
From the chat menu, the customer can turn announcements off / on, remove the link, or block the business.
For a linked customer, each is reported via webhook (duyuru_kapatildi, duyuru_acildi, baglanti_kaldirildi; blocking also sends baglanti_kaldirildi).
A customer who removed the link gets no messages by disKimlik or phone (kaldirdi); a customer who blocked you gets no messages or linking requests at all (engelli): this covers API messages, agent messages, automations, appointment / order cards, class and module announcements, and calls from the business.
Manage your inbox from the API: list, read, reply to, assign and close the conversations customers start from the Oki app and the web support widget.
The shortest way to build a bot: when the mesaj webhook arrives,
reply with POST /konusmalar/{konusma}/mesaj; when a human needs to take over, assign it to an agent with PUT /konusmalar/{id}.
Newest first. For older ones, send the id of the oldest message as oncesi. yon: gelen (customer), giden (you / agent / API) or not (internal team note; the customer does not see it).
Query parameters
Field
Type
Required
Description
oncesi
integer
optional
Messages older than this message ID.
sinir
integer
optional
1–200 (default 50).
Example request
curl -X GET "https://okime.com/v1/api/konusmalar/8812/mesajlar?sinir=50" \
-H "Authorization: Bearer $OKI_API_ANAHTARI"
Sends a reply to the conversation; it reaches both a customer in the Oki app and a visitor in the web support widget. The body is the same as POST /mesaj (text, media, buttons, sessiz, istemciKimligi required); recipient fields and tur are ignored, and the message counts as a reply. The conversation's unread count is reset to zero.
curl -X POST "https://okime.com/v1/api/konusmalar/8812/mesaj" \
-H "Authorization: Bearer $OKI_API_ANAHTARI" \
-H "Content-Type: application/json" \
-d '{
"metin": "The 49.90 TL extra charge on your invoice is the setup fee. Do you have any other questions?",
"dugmeler": [
{
"ad": "Yes, connect me to an agent",
"tur": "geri",
"veri": "temsilci"
},
{
"ad": "No, thanks",
"tur": "geri",
"veri": "kapat"
}
],
"istemciKimligi": "bot-8812-99840"
}'
[$kod, $c] = oki('POST', '/konusmalar/8812/mesaj', [
'metin' => 'The 49.90 TL extra charge on your invoice is the setup fee. Do you have any other questions?',
'dugmeler' => [
[
'ad' => 'Yes, connect me to an agent',
'tur' => 'geri',
'veri' => 'temsilci',
],
[
'ad' => 'No, thanks',
'tur' => 'geri',
'veri' => 'kapat',
],
],
'istemciKimligi' => 'bot-8812-99840',
]);
const [kod, c] = await oki('POST', '/konusmalar/8812/mesaj', {
metin: 'The 49.90 TL extra charge on your invoice is the setup fee. Do you have any other questions?',
dugmeler: [
{
ad: 'Yes, connect me to an agent',
tur: 'geri',
veri: 'temsilci',
},
{
ad: 'No, thanks',
tur: 'geri',
veri: 'kapat',
},
],
istemciKimligi: 'bot-8812-99840',
});
kod, c = oki("POST", "/konusmalar/8812/mesaj", {
"metin": "The 49.90 TL extra charge on your invoice is the setup fee. Do you have any other questions?",
"dugmeler": [
{
"ad": "Yes, connect me to an agent",
"tur": "geri",
"veri": "temsilci",
},
{
"ad": "No, thanks",
"tur": "geri",
"veri": "kapat",
},
],
"istemciKimligi": "bot-8812-99840",
})
In the dashboard, API and integration → Webhook URL: a URL on your server starting with https:// (e.g. https://example.com/oki/webhook).
On first save, the signing secret (oks_…) is shown once; store it on your server. You can rotate it from the dashboard (the old one stops working immediately).
Use Send test (or POST /webhooklar/deneme) to confirm that the deneme (test) event arrives and its signature verifies.
Without the dashboard, via the API: you can also register the webhook URL with your API key (it is the same setting as in the dashboard).
PUT /v1/api/webhook
Authorization: Bearer okb_…
Content-Type: application/json
{"adres": "https://example.com/oki/webhook"}
Field
Type
Required
Description
adres
string
no
URL starting with https:// (up to 500 characters). An empty string turns the webhook off.
sirYenile
boolean
no
true: a new signing secret is generated; the old one stops working immediately.
Response: {"adres": "…", "sirVar": true, "sir": "oks_…"}. sir is returned only on first save and with sirYenile; it is shown once, so store it. Read the current setting with GET /v1/api/webhook (the secret is not returned). Error: 400 adres (the URL is not https://).
Only events that occur while a webhook URL is set are delivered; events that occur while no URL is set are not sent later.
Within 10 seconds, return 2xx. Queue the work and respond right away; do the heavy lifting later.
On any other status code, a timeout or a connection error, the event is retried at increasing intervals: 30 s, 1 min, 2 min, 4 min, 8 min, 16 min, 32 min, then hourly. Delivery is abandoned after 24 hours.
Redirects (3xx) are not followed and count as failures. Webhooks are not sent to internal-network or local addresses.
The same event may arrive more than once (e.g. if your response is lost in transit). Store the id; if you have already seen it, return 200 without processing.
t is refreshed on every attempt; reject signatures whose timestamp differs from your clock by more than 5 minutes.
A booking was created or its status changed (Appointments).
deneme
metin
"Send test" in the dashboard, or POST /webhooklar/deneme.
baglandi
istek, disKimlik, musteri
The customer approved the linking request (or was already linked).
baglanmadi
istek, disKimlik
24 hours passed without linking (no account / declined / no response).
baglanti_kaldirildi
disKimlik
A linked customer removed the link or blocked the business.
duyuru_kapatildi
disKimlik
A linked customer turned off announcements.
duyuru_acildi
disKimlik
A linked customer turned announcements back on.
iletildi
mesaj, disKimlik, zaman
A message you sent via the API (notification, reply, approval, verification) reached the customer's phone.
okundu
mesaj, disKimlik, zaman
The customer read your API message (a separate event for each message read).
mesaj
mesaj, konusma, kanal, disKimlik, ad, tur, icerik, zaman
The customer wrote to you (from the Oki app or the web widget). A list choice carries icerik.listeYaniti, a shared location has tur: "konum"; photos, videos, audio and documents sent from the app have turfoto / video / ses / belge.
dugme
mesaj, konusma, disKimlik, dugme {sira, ad, veri}, zaman
A caller pressed a query key in the switchboard; expects a JSON answer within 5 seconds and is not retried (Switchboard queries).
onay
onay, mesaj, disKimlik, karar, zaman
The approval request was decided (onaylandi / reddedildi) or expired (suresi_doldu). Not sent on cancellation.
Example: mesaj
{
"id": 5530,
"olay": "mesaj",
"zaman": "2026-10-29T09:41:07.880Z",
"veri": {
"mesaj": 99840,
"konusma": 8812,
"kanal": "oki",
"disKimlik": "12345",
"ad": "Ayşe Yılmaz",
"tur": "metin",
"icerik": {
"metin": "Hi, I have a question about my invoice"
},
"zaman": "2026-10-29T09:41:07.861Z"
}
}
disKimlik is set if the customer card has your ID; it is empty for customers who removed the link or have no ID. kanal: "web" means the web support widget (with the authenticated widget, disKimlik is set).
Recent deliveries are kept for 7 days. durum: bekliyor (queued or pending retry), gitti (delivered) or vazgecildi (could not be delivered for 24 hours).
If your server was down for a long time, you can find what you missed here and resend it.
Queues a past event with the same olay and veri as a new delivery. The new delivery has a different id; take this into account if you deduplicate by id.
Example request
curl -X POST "https://okime.com/v1/api/webhooklar/5534/yeniden" \
-H "Authorization: Bearer $OKI_API_ANAHTARI"
The web support widget is a chat window you add to your site with a single line; what customers write lands in your Oki Business inbox.
The authenticated widget recognizes customers who are signed in to your own customer portal: no name / email is asked, agents see your
disKimlik value on the customer card, and the same customer gets a single conversation even when writing from different devices.
In the Oki Business dashboard, Web support widget: allow your domain (e.g. example.com) and turn the widget on.
On the same page, Authenticated widget → Create signing secret. The secret (okk_…) is shown once; store it only on your server (never put it in the page / browser).
Sign when rendering your customer portal page and put the values in the script tag.
import crypto from'node:crypto';
function okiKimlik(musteri) {
const t = Math.floor(Date.now() / 1000);
const imza = crypto.createHmac('sha256', process.env.OKI_KIMLIK_SIRRI)
.update(`${t}.${musteri.id}.${musteri.ad}.${musteri.eposta}`).digest('hex');
return { t, imza };
}
// In your template: <script src="https://okime.com/w.js?v=2" data-oki="<WIDGET ID>" async// data-kimlik="…" data-ad="…" data-eposta="…" data-zaman="${t}" data-imza="${imza}"></script>
import hashlib, hmac, os, time
def oki_kimlik(musteri):
t = int(time.time())
metin = f"{t}.{musteri['id']}.{musteri['ad']}.{musteri['eposta']}"
imza = hmac.new(os.environ["OKI_KIMLIK_SIRRI"].encode(), metin.encode(), hashlib.sha256).hexdigest()
return t, imza
# In your template: <script src="https://okime.com/w.js?v=2" data-oki="<WIDGET ID>" async# data-kimlik="…" data-ad="…" data-eposta="…" data-zaman="{t}" data-imza="{imza}"></script>
Signed string: "<t>.<disKimlik>.<ad>.<eposta>" (empty fields are left empty, the dots remain). disKimlik uses the same format as in the API.
The signature is valid for 24 hours (generate a new one on every page load). If it does not match, the widget runs unauthenticated (like the public widget) and a warning appears in the browser console.
If another customer signs in on the same browser, the previous customer's conversation is not shown.
The topic menu appears in the widget too (Topics in the dashboard).
When the customer writes, the mesaj webhook has kanal: "web" and disKimlik set; you can reply in the widget with POST /konusmalar/{id}/mesaj.
If, in the dashboard under API and integration → Card URL, you enter a URL with the {dis_kimlik} placeholder (e.g. https://example.com/panel/musteri/{dis_kimlik}),
your agents can open that customer directly in your own system with Open in panel on the customer card.
In the panel (Settings → Appointments & calendar) the business defines services (duration, capacity) and weekly hours; customers pick a free slot and book from their chat with you in Oki. With the API you can create bookings from your own system (website, sign-up form), read the calendar and change statuses. A booking shows up in the customer's chat as a card; the card updates when the status changes, confirmations and cancellations reach the customer with a notification, and reminders are sent automatically. There are no per-message fees.
Bookings in the range (unix ms; at most 62 days): id, hizmet, hizmetAd, musteri, baslangic, bitis, durum, notu, kaynak.
POST /randevular
{"disKimlik" | "telefon", "hizmet", "bas" (ms), "notu"} — creates a booking (status onaylandi); 409 dolu when the slot is full. The customer gets a card with a notification.
Webhook event randevu: randevu, durum, hizmet, baslangic, bitis, kaynak (musteri | personel | api), disKimlik. Sent when a booking is created and on every status change.
Customers who call you on Oki are greeted by a voice menu ("For Sales, press 1"). Customers you allowed to call can call (on businesses Oki has granted "anyone can call", every Oki user). The key they press sends the call to a team (a group of agents) or to a single agent; if nobody is free the customer waits in line, sees their position and hears periodic announcements. The menu is read out on the customer's phone: audio never passes through the server and the call's end-to-end encryption is unchanged. Configure it in the panel (Settings → OkiMe Switchboard) or with the endpoints below.
{"acik", "ayar"} — writes the whole configuration; the response is the same as GET. Turning it on needs at least one key in the menu (400 menu_bos); an invalid field returns 400 santral.
POST /santral/birimler
{"ad", "uyeler": ["905…"]} — adds a team (up to 30); members are the Oki numbers of members allowed to reply to chats. Response {"id"}.
PUT /santral/birimler/{id}
Changes the name and members.
DELETE /santral/birimler/{id}
Deletes it; if used in the menu, outside hours or as the default team: 409 kullaniliyor.
ayar fields:
Field
Description
dil
Reading language (tr, en, de…). If an option has no text, the prompt is built automatically in tr / en.
ses
kadin (Sarah, default) | erkek (Liam) | cihaz. Texts are voiced by Oki (free of charge) when saved; with cihaz, or while a text is not ready yet, the customer's phone voice reads it. GET /santral → seslendirme {hazir, toplam}.
karsilama
Greeting read first (up to 500 characters).
menu
{"metin", "secenekler": [{"tus": "0"–"9", "ad", "eylem", "birim", "temsilci", "metin", "alt"}]}. eylem: birim (team id in birim), temsilci (member's number in temsilci), alt (submenu in alt, up to 4 levels), bilgi (reads metin, returns to the menu), mesaj (voice message), geri_arama (call back), sorgu (sorgu: the code of a switchboard query block). Up to 10 keys per menu, 60 in total. {secenekler} in metin marks where the options are read. * repeats, # goes back.
mesai
{"kaynak": "her_zaman" | "isletme" | "ozel", "ozel": {"gunler": [1–7], "bas": "09:00", "bit": "18:00"}}. isletme: business hours from Automations. Turkey time.
Team for calls from (older) app versions that don't show the menu; if empty, the usual routing (assigned agent, then team).
bekleme
anonsSn (10–300, 30), enUzunSn (30–1800, 300), kuyrukSiniri (1–100, 20), calmaSn (10–60, 20: if the reserved agent doesn't answer, the team's other free members ring), siraMetni ({sira}, {dakika}), eylem (when time runs out: secim | mesaj | geri_arama), muzik (hold music: oki | kapali).
A call-back request arrives in the conversation as the customer's message ("📞 Please call me back · Sales"); the mesaj webhook carries icerik.santral. A voice message is a regular ses message. After each call an internal note (with the team) is added to the conversation.
A customer who calls you on Oki presses a key in your OkiMe Switchboard menu and receives information about themselves from your own CRM: balance, bonus, withdrawal status, invoice, campaign, order status or any record in your system. While the call stays open, Oki sends a signed request to your webhook address; your answer lands in the customer's Oki chat with you as a message from your business profile, and the caller hears a spoken confirmation such as "Your request has been sent to you as a message." Because the answer arrives in writing, the customer does not have to note down figures and can look at it again later; none of your agents is tied up.
Setup works like building blocks: first you define a query block, then you attach it to a key in your switchboard menu. The only code you write is a small handler at your webhook address that answers the santral_sorgu request.
Settings → API & integration → Webhook address: enter your address starting with https:// and keep the signing secret (oks_…) (see Webhook setup). Queries are sent to this address; no separate address is needed.
Settings → API & integration → Switchboard queries → Add block: fill in the fields below (e.g. code bakiye, name "Balance", a four-digit PIN on the keypad).
In the Settings → OkiMe Switchboard editor open an option (key), choose the action Look up info (CRM) and pick the block from the list. Write the option name ("Balance") and the text to be read like any other option; the texts are voiced when you save.
On the Switchboard queries page, press Test next to the block to send a real request to your address (deneme: true, no message goes to anyone). You see your answer, the response time and any error right there.
Call your business on Oki from your own phone, press the key and check that the message arrives in the chat.
Block fields (up to 50 blocks per business):
Field
Type
Required
Description
kod
string
required
2–32 characters; lower-case letters, digits and _ (^[a-z0-9_]{2,32}$). Unique within the business and cannot be changed. It reaches you in the request's sorgu field; your handler uses it to know which information is wanted. E.g. bakiye, bonus, cekim, fatura.
ad
string
required
1–60 characters. The name shown in the editor and on the Switchboard queries page ("Balance"). Not read to the caller.
aciklama
string
optional
Up to 300 characters; a note for your team.
kimlik
string
required
oki: a request is sent for every caller (directly by Oki number). bagli: a request is sent only for customers who have linked their account, so disKimlik is always set; an unlinked caller hears an announcement saying the account must be linked first, and no request reaches you. See Identity and verification.
girdi
string
required
yok: the request is sent as soon as the key is pressed. rakam: the caller first types digits on the keypad (PIN, customer no., order no., year of birth…), then the request is sent.
girdiMetni
string
required if rakam
Up to 300 characters. Read (and voiced) before the digits are requested: "Please enter your four-digit PIN, then press hash."
girdiUzunluk
integer
required if rakam
1–16: the maximum number of digits. Once that many digits are typed the request goes without waiting for #; a shorter entry ends with #.
anons
string
optional
Up to 300 characters. Read on success when your response carries no anons; if this is empty too, Oki's standard sentence ("Your request has been sent to you as a message.") is read. Voiced.
aktif
boolean
optional
Default true. A caller who presses the key of a disabled block hears that the service is currently unavailable; no request reaches you. Disable a block during maintenance instead of deleting it.
In the menu, the option's action is sorgu and its sorgu field is the block code (e.g. {"tus": "1", "ad": "Balance", "eylem": "sorgu", "sorgu": "bakiye"}; see switchboard settings). When the menu is saved the code must point to a defined, active block, otherwise 400 is returned.
There are three ways to establish who is calling; you can combine them in one block.
Mode
Block setting
How it works
When to use
Directly by Oki number
kimlik: "oki", girdi: "yok"
An Oki account is opened with phone verification and the call comes from the signed-in Oki app; the number cannot be spoofed the way caller ID can on a phone line. The request carries musteri, numara and (if linked) disKimlik; you find the customer in your CRM with these.
Non-sensitive information such as campaigns or order status, or when you already store the customer's Oki number.
Linked account only
kimlik: "bagli"
The customer has approved the link earlier through Account linking; the request carries your own ID as disKimlik, with bagli: true. No request is sent for unlinked callers.
Personal data such as balance or invoices: the match rests on the customer's own approval.
Keypad input
girdi: "rakam"
The caller types digits such as a PIN, customer number or year of birth; Oki passes them unchanged in girdi. You do the verification and answer dogrulanamadi or bulunamadi.
Cases where you want a second factor (withdrawals, payment data), or to find a customer whose number you do not store by their customer number.
Combining: the strongest setup is kimlik: "bagli" + girdi: "rakam": the account was matched with the customer's consent and the PIN answers "is the person holding the phone really the customer". kimlik: "oki" + customer number + PIN suits customers who have not linked their account.
While digits are typed they show as • on the caller's screen. If no key is pressed for 15 seconds, an announcement says nothing was entered and the caller returns to the main menu; no request reaches you.
Verify the signature:Oki-Imza is the same as the regular webhook signature (same oks_ secret). Verify it over the raw body with a constant-time comparison and return 401 if t is older than 5 minutes. Never return data for an unsigned request.
Never log the PIN: do not write the girdi field, the raw body or the whole request to any log, error tracker or database record. Oki never stores the input and does not write it to its own logs either.
Compare hashes: do not store PINs in plain text; store a password_hash / bcrypt / scrypt / Argon2 hash and check it with a constant-time comparison such as password_verify or timingSafeEqual.
Oki's limits: after 3 consecutive dogrulanamadi answers, that query is locked for that customer for 15 minutes (the caller hears "Too many failed attempts. Please try again later."; no request reaches you). In addition, a customer can make at most 10 queries per 10 minutes; beyond that the same announcement is read. Oki may adjust these limits when needed. You may also apply your own lockout rules.
Answer within 5 seconds: the customer is on the line. Oki waits at most 5 seconds, does not follow redirects (3xx) and does not read responses larger than 64 KB. If preparing the data takes longer, use a deferred reply.
Send only what is needed: the message stays in the customer's chat; do not include full card numbers, passwords or national ID numbers, mask them (**** 4821).
Test requests:deneme: true comes from "Test" in the dashboard; your answer is not sent to anyone. Do not perform side effects (such as opening a withdrawal request) for it.
Switchboard queries are not retried. Unlike the other webhook events, this request is sent synchronously while the caller is on the line; it is not repeated for 24 hours after a timeout or error response. Do not queue it; answer in the same request.
Event name. Other events arrive at the same address, so branch your handler on it.
Oki-Teslim
The query ID (sorguId; a string starting with sq_, not a number as in other events). You use it for a deferred reply.
Oki-Imza
t=<unix seconds>,v1=<hex>; v1 = HMAC-SHA256(secret, "<t>.<raw body>"). Same as Verifying signatures.
veri fields:
Field
Type
Description
sorgu
string
The block's kod (e.g. bakiye). Tells you which information is wanted.
sorguId
string
Unique ID of this query; equal to id and Oki-Teslim. Keep it when you answer sonra.
musteri
integer
The customer's ID in Oki; the same musteri as in other webhooks.
numara
string
The caller's Oki number (digits only). The account is phone-verified and the call comes from the signed-in app. It is sent because the customer called you; use it only to answer this query.
disKimlik
string
Your customer ID if the customer has linked their account; otherwise an empty string.
bagli
boolean
Whether the customer is linked to you. Always true for kimlik: "bagli" blocks.
ad
string
The name on your customer card (may be empty). Do not use it for verification.
girdi
string
The digits the caller typed (without #); an empty string for girdi: "yok" blocks. Never log it.
dil
string
The switchboard's spoken language (tr, en, de…). Write mesaj and anons in this language.
deneme
boolean
true when sent with Test from the dashboard or the API: your answer is not delivered, do not perform side effects.
Respond within 5 seconds with HTTP 200 and a JSON body:
HTTP/1.1 200 OK
Content-Type: application/json
{"durum": "tamam",
"mesaj": "Your current balance: 1,250.00 TL (as of 8 Nov 2026 13:00)",
"anons": "Your balance has been sent to you as a message."}
Field
Type
Required
Description
durum
string
required
One of the values in the table below.
mesaj
string
optional
Up to 2000 characters, plain text (no formatting or buttons; \n for line breaks). With tamam it is sent from your business profile to the customer's Oki chat. If empty no message is sent; only the announcement is read. Longer text is cut at 2000 characters and mesaj_uzun is logged.
anons
string
optional
Up to 300 characters, plain text. Read to the caller immediately: Oki voices the text with a natural voice. If omitted, the block's anons or Oki's standard sentence is read; the standard sentence is also read if voicing fails at that moment. Longer text is cut at 300 characters (anons_uzun). Keep amounts and personal data out of the announcement (people nearby can hear it); send them in the message.
durum
What Oki does
What the caller hears (without anons)
tamam
Sends mesaj (if any) from your business profile to the customer's chat. At least one of mesaj and anons must be set (both empty is gecersiz_yanit). The caller returns to the main menu.
"Your request has been sent to you as a message."
sonra
Sends nothing now; you send the message within 24 hours with a deferred reply. The mesaj field is ignored.
"Your request has been received. The details will be sent to you as a message shortly."
dogrulanamadi
Counts a failed attempt. If attempts remain, the app asks for the digits again; after 3 consecutive failures the query is locked for that customer for 15 minutes.
"The details you entered could not be verified." (digits are asked again if attempts remain)
bulunamadi
Sends nothing.
"We could not find your record."
hata
Sends nothing; writes isletme_hatasi to the switchboard error log.
"We cannot reach your information right now. Please try again later." (anons is ignored)
All standard sentences are read in the switchboard's language (8 languages). With tamam, sonra, dogrulanamadi and bulunamadi, send anons to have your own wording read, e.g. bulunamadi with "We couldn't find an order with that number."
If no usable answer arrives: on no response within 5 seconds, connection failure, a non-2xx status, a redirect, a non-JSON or malformed body, an unknown durum, or when no webhook address is set, the caller hears "We cannot reach your information right now. Please try again later.", no message is sent and the error is written to the switchboard error log.
If you cannot prepare the information within 5 seconds (e.g. the invoice summary comes from another system), answer sonra first so the caller is informed immediately:
{"durum": "sonra", "anons": "Your invoice summary is being prepared and will arrive as a message in a few minutes."}
Then send the message within 24 hours using the sorguId. The call is authenticated with your API key like every other /v1/api endpoint (Authorization: Bearer okb_…; see Common headers).
Adds a new block; the response is {"sorgu": {…}}, the saved block (an empty kimlik becomes oki, an empty girdi becomes yok).
Example request
curl -X POST "https://okime.com/v1/api/santral/sorgular" \
-H "Authorization: Bearer $OKI_API_ANAHTARI" \
-H "Content-Type: application/json" \
-d '{
"kod": "cekim",
"ad": "Withdrawal status",
"aciklama": "Status of the latest withdrawal request",
"kimlik": "bagli",
"girdi": "rakam",
"girdiMetni": "Please enter your year of birth.",
"girdiUzunluk": 4,
"anons": "The status of your withdrawal has been sent to you as a message.",
"aktif": true
}'
Possible errors
HTTP
kod
When
400
sorgu
A field rule (code format, lengths, missing girdiMetni / girdiUzunluk with girdi: "rakam"); hata says which.
Writes the whole block: put every field, including kod, in the body (missing fields count as empty). The {kod} in the path selects the block; a different kod in the body renames it (409 kullaniliyor if the menu uses it). Use aktif: false to disable it. The response is {"sorgu": {…}}.
Sends a real, signed santral_sorgu request to your webhook address (deneme: true) and returns your answer as received; no message is sent and nothing is read out. The Test button in the dashboard does the same. Optional numara: the Oki number to use as the caller (if it belongs to one of your customers, musteri, disKimlik, bagli and ad are filled from that customer; if omitted they are empty); girdi: digits to send as if typed.
{
"durum": "tamam",
"mesaj": "Your current balance: 1,250.00 TL",
"anons": "Your balance has been sent to you as a message.",
"sureMs": 312,
"http": 200,
"hata": "",
"kod": ""
}
Even if your address fails or no webhook address is set, the call returns 200; kod is the error code and hata the detail (http: the status your address returned, 0 if there was no connection):
Block: kod: "bakiye", kimlik: "oki", girdi: "rakam", girdiUzunluk: 4. The handler verifies the signature, finds the customer, compares the PIN hash in constant time and returns the balance as a message. Other events arriving at the same address go to your usual handler.
<?php
// oki_santral.php — answers Oki Switchboard queries ("bakiye" + PIN example)
$sir = getenv('OKI_WEBHOOK_SIRRI'); // oks_… (webhook signing secret)
$govde = file_get_contents('php://input'); // raw body (before json_decode)
$imza = $_SERVER['HTTP_OKI_IMZA'] ?? '';
if (!preg_match('/^t=(\d+),v1=([0-9a-f]{64})$/', $imza, $p)
|| abs(time() - (int)$p[1]) > 300
|| !hash_equals(hash_hmac('sha256', $p[1] . '.' . $govde, $sir), $p[2])) {
http_response_code(401);
exit;
}
$olay = json_decode($govde, true);
if (($olay['olay'] ?? '') !== 'santral_sorgu') {
// Other events: your usual webhook handler (queue it, return 200).
http_response_code(200);
exit;
}
// CAUTION: $govde and $olay carry the PIN the caller typed; never log them.
$v = $olay['veri'];
/** Answer Oki and stop. */
function yanit(string $durum, string $mesaj = '', string $anons = ''): void {
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['durum' => $durum, 'mesaj' => $mesaj, 'anons' => $anons],
JSON_UNESCAPED_UNICODE);
exit;
}
try {
if ($v['sorgu'] !== 'bakiye') {
yanit('bulunamadi');
}
$db = new PDO(getenv('DB_DSN'), getenv('DB_USER'), getenv('DB_PASSWORD'),
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
// 1) Find the customer: by disKimlik (your own ID) if the account is linked,
// otherwise by the Oki number stored in your CRM.
if ($v['bagli']) {
$q = $db->prepare('SELECT id, pin_hash, balance_cents FROM customers WHERE id = ?');
$q->execute([$v['disKimlik']]);
} else {
$q = $db->prepare('SELECT id, pin_hash, balance_cents FROM customers WHERE oki_number = ?');
$q->execute([$v['numara']]);
}
$m = $q->fetch(PDO::FETCH_ASSOC);
if (!$m) {
yanit('bulunamadi');
}
// 2) PIN: compare against the hash stored with password_hash().
// password_verify() runs in constant time; never store the plain PIN.
if (!password_verify($v['girdi'], $m['pin_hash'])) {
yanit('dogrulanamadi'); // Oki counts the attempt and locks after 3 failures
}
// 3) The information. If $v['deneme'] is true it is a "Test" run: no side effects.
$amount = number_format($m['balance_cents'] / 100, 2, '.', ',');
yanit('tamam',
"Your current balance: $amount TL (as of " . date('j M Y H:i') . ')',
'Your balance has been sent to you as a message.');
} catch (Throwable $e) {
error_log('oki santral_sorgu ' . $v['sorguId'] . ': ' . $e->getMessage()); // no input
yanit('hata');
}
// npm i express
const express = require('express');
const crypto = require('crypto');
const db = require('./db'); // your own data layer
const app = express();
// The raw body is required: the signature is checked before JSON parsing.
app.post('/oki/webhook', express.raw({ type: 'application/json', limit: '64kb' }), async (req, res) => {
const govde = req.body; // Buffer
const p = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(req.get('Oki-Imza') || '');
if (!p || Math.abs(Date.now() / 1000 - Number(p[1])) > 300) return res.sendStatus(401);
const expected = crypto.createHmac('sha256', process.env.OKI_WEBHOOK_SIRRI)
.update(p[1] + '.').update(govde).digest();
if (!crypto.timingSafeEqual(expected, Buffer.from(p[2], 'hex'))) return res.sendStatus(401);
const olay = JSON.parse(govde.toString('utf8'));
if (olay.olay !== 'santral_sorgu') {
enqueue(olay); // other events
return res.sendStatus(200);
}
// CAUTION: olay.veri.girdi is the PIN; never log it.
const v = olay.veri;
try {
if (v.sorgu !== 'bakiye') return res.json({ durum: 'bulunamadi' });
const c = v.bagli
? await db.findCustomer({ id: v.disKimlik }) // linked account
: await db.findCustomer({ okiNumber: v.numara }); // Oki number in your CRM
if (!c) return res.json({ durum: 'bulunamadi' });
if (!(await pinMatches(v.girdi, c.pinHash))) return res.json({ durum: 'dogrulanamadi' });
const amount = (c.balanceCents / 100).toLocaleString('en-GB', { minimumFractionDigits: 2 });
return res.json({
durum: 'tamam',
mesaj: `Your current balance: ${amount} TL`,
anons: 'Your balance has been sent to you as a message.',
});
} catch (e) {
console.error('santral_sorgu', v.sorguId, e.message); // input is not logged
return res.json({ durum: 'hata' });
}
});
// PIN hash stored as "salt:hex" (scrypt). timingSafeEqual compares in constant time.
async function pinMatches(pin, stored) {
const [salt, hex] = String(stored || '').split(':');
if (!pin || !salt || !hex) return false;
const derived = await new Promise((ok, fail) =>
crypto.scrypt(pin, salt, 32, (err, buf) => (err ? fail(err) : ok(buf))));
return crypto.timingSafeEqual(derived, Buffer.from(hex, 'hex'));
}
app.listen(3000);
Every system error during a query is written to the switchboard error log. In the app it appears under Settings → API & integration → Switchboard queries → Recent errors with time, block, error code and duration; the same page shows the last 50 queries (time, block, durum, duration) and each block's query / error count for today. The counts are also available through GET /santral/sorgular → istatistik. The caller's input is never written to the log.
Error code
Meaning
What to do
zaman_asimi
Your address did not answer within 5 seconds.
Speed it up or use sonra.
http_502 (e.g.)
Your address returned a non-2xx status (the code is in the name), or redirected.
Check your server log; for 401, check your signature verification.
baglanti
Could not connect to your address (DNS, certificate, server down).
Check the address is reachable from outside and has a valid TLS certificate.
gecersiz_yanit
The body is not JSON, is malformed, is larger than 64 KB, or tamam came with both mesaj and anons empty.
Check Content-Type: application/json and the body.
bilinmeyen_durum
durum is not one of the known values.
Return only tamam, sonra, dogrulanamadi, bulunamadi, hata.
webhook_yok
No webhook address is set.
Set the address.
isletme_hatasi
You returned durum: "hata".
Search your own log for the sorguId.
mesaj_uzun / anons_uzun
Text exceeded the limit; it was cut before sending / reading.
mesaj ≤ 2000, anons ≤ 300.
mesaj_gitmedi
Your answer was received but the message could not be sent to the chat (e.g. daily automatic message limit).
Tell us if it persists.
seslendirme
anons could not be voiced at that moment; the standard sentence was read instead.
Customers calling with an older Oki version that does not know switchboard queries can still press the key:
Blocks without input (girdi: "yok") work as usual: the request reaches you, the message lands in the chat and the caller hears the announcement; then the call ends (it does not return to the main menu).
Blocks that ask for digits (girdi: "rakam") do not work on old versions: the caller hears "Please update the Oki app to use this option." and no request reaches you.
In the panel (Settings → Catalog & orders) the business keeps its product / service / menu list (photo, category, price, stock); customers see it from their chat with you in Oki and place orders from a cart. Prices are taken from the catalog at order time. An order is a card in the customer's chat; the card updates when the status changes and the customer is notified. Prices are in kuruş (TRY cents).
Orders (newest first; acik=1 excludes delivered / cancelled; last 30 days when no range is given): id, kalemler (urun, ad, adet, fiyatKurus), toplamKurus, durum, odeme, notu, musteri.
PUT /siparisler/{id}
{"durum"}: yeni → onaylandi | iptal, onaylandi → hazirlaniyor | hazir | teslim | iptal, hazirlaniyor → hazir | teslim | iptal, hazir → teslim | iptal; an invalid transition returns 409 durum.
Webhook event siparis: siparis, durum, odeme, kalemler, toplamKurus, notu, disKimlik. Sent when an order is placed and on every status change. The odeme field (here and in the GET /siparisler response) is always yok for now (card payment has been removed).
Bot: when a customer writes to you, the mesaj webhook arrives and you answer with reply to a conversation; geri buttons let them choose. You can also define a fixed menu (up to 20 commands) next to the customer's message box: the tapped command's name arrives as a customer message and its data is in icerik.menu of the mesaj webhook (only data of a defined command passes).
Command description and form: each command can have an optional aciklama (description, up to 80 characters) and a form (up to 8 fields). When a command with a form is picked, the customer fills in the fields on Oki's own form screen (you cannot send HTML or a page). Field: {"ad", "etiket", "tur", "secenekler", "zorunlu"}; ad is the key you receive (lowercase letters, digits, underscore; 1–24), etiket is the label the customer sees (1–40), tur: metin (text), sayi (number), tarih (date, YYYY-MM-DD), saat (time, HH:MM), secim (choice; secenekler: 2–10 options), onay (checkbox; evet / hayir), konum (location, shared by the customer through Oki's own consent prompt; value "lat,lng") or foto (photo; value evet, and the photo arrives right after as a separate foto message). zorunlu marks a required field. The answers arrive in the mesaj webhook as icerik.form, {field name: value} (all values are strings; optional fields left empty are omitted); icerik.metin is the command name followed by Label: value lines. Values are validated on the server against your definition; undefined fields are dropped. A customer who has not updated Oki sends the command without a form (no icerik.form): ask for the missing details in the chat. You cannot ask for passwords, card numbers or ID numbers: a label or description like that is rejected with 400.
{"menu": [{"ad": "Book a visit", "veri": "randevu", "aciklama": "Pick a day and time",
"form": [{"ad": "gun", "etiket": "Day", "tur": "tarih", "zorunlu": true},
{"ad": "hizmet", "etiket": "Service", "tur": "secim", "secenekler": ["Haircut", "Shave"]}]}]}
// mesaj webhook: "icerik": {"metin": "Book a visit\nDay: 2026-12-01\nService: Haircut", "menu": "randevu",
// "form": {"gun": "2026-12-01", "hizmet": "Haircut"}}
Registered domains and bot settings:GET /bot-ayar and PUT /bot-ayar read / write {"alanAdlari": ["example.com", "*.example.com"], "yzAcik", "yzBilgi"} (up to 20 domains; example.com covers itself and its subdomains, *.example.com only subdomains). The domains of your mini app and web chat widget count as registered automatically. If the domain of an adresbutton is not registered, the button is still delivered, but the customer sees a warning showing the address before it opens; a registered address opens directly. Oki may later reject unregistered addresses with 400 alan_adi: register the domains your buttons use now.
“Automated reply” label: messages you send through the API are shown to the customer with an “Automated reply” label. If a person wrote the message (from your own support screen), send "insan": true in the request and no label is added. Use this field only when a person really wrote it.
AI responder (if enabled for your account; yzKullanilabilir in the GET /bot-ayar response): answers customers’ questions in chats not assigned to an agent, using only the text you put in yzBilgi (up to 20,000 characters). If the answer is not there, or the customer asks for a person, it leaves the chat to your team and stays quiet in that chat; it also does not step in after an agent has written. It takes no actions and calls no tools. Its replies appear in the message flow with icerik.oto: "Yapay zekâ"; menu commands go to you (webhook), not to the responder.
Mini app: your web app (orders, bookings, account…) opens inside Oki from the customer's chat: via the app icon in the chat header or an uygulama type button in a message. An okiGiris parameter is added to the URL; the customer doesn't log in.
Endpoint
Description
GET /mini-uygulama
ad, adres, menu ([{ad, veri, aciklama?, form?}]), sirVar.
PUT /mini-uygulama
{"ad", "adres", "menu"}. adreshttps:// (empty: mini app off); ad 1–24; command ad 1–24, veri 1–64 ASCII; up to 20 commands; aciklama and form are optional (above). On first save the response contains sir once.
POST /mini-uygulama/sir
Renews the secret ({"sir"}); logins signed with the old one stop working.
Verifying okiGiris:okiGiris = <payload>.<signature>; signature = hex(HMAC-SHA256(secret, payload)), payload = base64url(JSON). JSON: isletme (your Oki number), musteri (Oki customer ID), disKimlik (your ID for a linked customer), ad, dil, zaman (unix seconds). Compare the signature in constant time, reject if zaman is older than 10 minutes, then open your own session.
Every response includes an Oki-Istek header. Log it on your side; include this ID when asking for support so we can find the issue directly.
Your requests for which the API returned 4xx / 5xx appear in the API log in the Oki Business dashboard for the last 14 days: time, endpoint
(e.g. POST /v1/api/mesaj), HTTP status, kod (and neden, if any), error text, duration and the Oki-Istek ID; plus daily request / error counts.
This section is visible to members who can manage API and integration settings.
Linking happens only with the customer's approval; you do not receive the Oki number or phone number, only a "linked" status and your own disKimlik value. The response to a linking request does not reveal whether the number is on Oki.
When sending a message or verification code by phone number, an oki_yok response tells you there is no Oki user with that phone so that you can fall back to SMS. Use this information only for that send; do not scan numbers.
Write only to your own customers, within the relationship in which you serve them. Do not message purchased lists or lists collected without consent.
The islem (transactional) type is only for service notifications the customer expects; ads and campaigns go as duyuru (announcement). Customers can turn off announcements; they are sent only between 08:00–21:00 and only to customers who have exchanged messages with your business (iliski_yok).
Use the verification code endpoint only in real verification flows; never ask the customer for the code by phone or message (the message tells the customer that your staff will never ask for the code).
Business chats are not end-to-end encrypted; they are stored on Oki servers on behalf of your business (the customer sees this in the chat).
The API key (okb_), webhook signing secret (oks_) and identity secret (okk_) must stay on your server only; never put them in a browser, mobile app, repository or logs. If one leaks, rotate it from the dashboard immediately.
Abuse (spam, misleading content, advertising with the islem type) leads to customers blocking you and to suspension of the business account (403).
Switchboard queries: because the customer called you, the request includes their Oki number (numara); use it only to answer that query and do not add it to marketing lists. The digits the caller types (girdi) are not stored by Oki; do not log them either.
Descriptions and forms on bot commands: menu commands accept aciklama and form (text, number, date, time, choice, checkbox; up to 8 fields); answers arrive as icerik.form in the mesaj event; form field types include konum and foto. Menu limit raised from 10 to 20 commands. Registered domains (/bot-ayar; customers are warned before opening a button link on an unregistered domain). “Automated reply” label on API messages (turn off with insan: true). AI responder settings. Existing menus and messages keep working unchanged.
Docs
12 November 2026
Announcements need a conversation: tur: duyuru to a customer found by phone number only, who has not yet written or replied to your business, is rejected with 403 iliski_yok. Transactional types are unchanged.
Docs
8 November 2026
Switchboard queries (CRM data): customer-specific data from your CRM at the press of a switchboard key; the santral_sorgu webhook (synchronous, signed), POST /santral/sorgu/{sorguId}/yanit, the /santral/sorgular block endpoints and dene; the sorgu action in the switchboard menu.
Docs
8 November 2026
List picker (liste field; the choice arrives as the customer's reply in the mesaj webhook with icerik.listeYaniti). New button types: konum (request location) and takvim (add to calendar). icerik.yedek fallback text for older app versions. foto / video / ses / belge / konum messages from customers.
Docs
31 October 2026
Bots and mini apps: /mini-uygulama endpoints, uygulama button type, okiGiris signature, icerik.menu in the mesaj event. Pricing and middleman comparison in “Why Oki?”. Appointments endpoints (/randevu-hizmetleri, /randevular) and the randevu webhook event. Catalog & orders endpoints (/katalog, /siparisler) and the siparis event.
v2
29 October 2026
Recipient selection: disKimlik, telefon or konusma — sending without linking, too.
Buttons: adres, geri (dugme webhook), telefon, kopyala; up to 10; tekSecim. sessiz (silent) sending.
Message editing (PATCH /mesaj/{id}) and recall (DELETE /mesaj/{id}).
Batch messages (POST /mesaj/toplu, up to 100).
Approval requests (/onay) and the onay webhook.
Verification codes (/dogrulama, check endpoint).
Customer list and fields (/musteriler, /alanlar).
Conversations: inbox, messages, reply (including the web widget), status / assignment, read.
Media: photos and documents (POST /medya).
Webhook history, test and resend endpoints.
Oki-Istek on every response; API log in the dashboard. New neden values: oki_yok, kaldirdi.
v1
25 October 2026
API keys, GET /ben.
Account linking (/baglama) and the baglandi / baglanmadi webhooks.
Transactional notifications and announcements to linked customers (POST /mesaj), status lookup (GET /mesaj/{id}).
Signed webhooks: iletildi, okundu, mesaj, linking and announcement preferences.
Authenticated web support widget.
Migrating from v1: v1 endpoints and fields work unchanged. istemciKimligi is required on POST /mesaj (otherwise 400 istemci_kimligi); the button limit went up from 3 to 10. A button without a type is treated as adres, so v1 buttons work as they are.
Oki Business API · v2 · 29 October 2026 · For questions, request support from the Oki Business dashboard; include the Oki-Istek ID from error responses.