Oki Business APIv2 TREN

1.Introduction

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.

Why Oki? A quick comparison

The table below shows features that work in Oki today. The other two columns roughly summarize how you get the same feature there.

FeatureOki Business APIWhatsApp Business PlatformTelegram 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 countryBot API is free; verification codes are a separate product (Gateway) charged per code
Connect without a middleman✓ Key from the panel, directMostly 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 neededOutside the 24-hour window, an approved template is requiredOnly to users who have started the bot
Built-in verification code endpoint (generate + check + attempt limit)✓ POST /dogrulama, same API as messagingAuthentication templates exist; generating and checking the code is up to youNot in the Bot API; separate product: Telegram Gateway API
Time-limited Approve / Decline card + decision webhook✓ POST /onayYou build it yourself with buttonsYou build it yourself with buttons
List picker; location request✓ liste (2–10 options), konum button✓ (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 + dashboardNot in the API (your own CRM or a partner product)No
Inbox, agent assignment, web support widget✓ in the same APINot 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.

2.Getting started

Base URL and key

All endpoints live under this base URL:

https://okime.com/v1/api
  1. 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").
  2. 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.
  3. 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.

Common headers

HeaderDirectionDescription
Authorization: Bearer okb_…requestRequired on every request. Missing or invalid: 401.
Content-Type: application/jsonrequestOn requests with a body. The body is UTF-8 JSON; at most 1 MB (4 MB for bulk messages, 8 MB for customer imports).
Content-Type: application/jsonresponseAll responses are JSON.
Oki-Istek: 3f9c2a7be1d04c55responseThe request ID, on every response. Quote this value when contacting support; failed requests appear under this ID in the API log in the dashboard.

Times are UTC in RFC 3339 format (e.g. 2026-10-29T09:30:00Z). IDs (mesaj, konusma, musteri) are numbers; istek, onay, dogrulama are strings.

First request

Returns the business your key belongs to; ideal for testing your connection.

The key's business

GET/v1/api/ben

Validates the key and returns your business's ID, name and Oki number.

Example request

curl -X GET "https://okime.com/v1/api/ben" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "isletme": {
    "id": 4,
    "ad": "Example SMS Inc.",
    "numara": "48213790526"
  }
}

Possible errors

HTTPkodWhen
401—The key is missing, does not start with okb_, or is invalid. Body: {"hata": "API anahtarı geçersiz"}
403—The business is suspended.

Helper function

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.

<?php
const OKI_ADRES = 'https://okime.com/v1/api';
$okiAnahtar = getenv('OKI_API_ANAHTARI'); // or a secret config file

/** Oki API request: returns [HTTP status, response array]. */
function oki(string $yontem, string $yol, ?array $govde = null): array {
    global $okiAnahtar;
    $c = curl_init(OKI_ADRES . $yol);
    curl_setopt_array($c, [
        CURLOPT_CUSTOMREQUEST  => $yontem,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 10,
        CURLOPT_HTTPHEADER     => [
            'Authorization: Bearer ' . $okiAnahtar,
            'Content-Type: application/json',
        ],
    ]);
    if ($govde !== null) {
        curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($govde, JSON_UNESCAPED_UNICODE));
    }
    $yanit = curl_exec($c);
    $kod = curl_getinfo($c, CURLINFO_RESPONSE_CODE);
    curl_close($c);
    return [$kod, json_decode($yanit ?: '{}', true) ?? []];
}

[$kod, $c] = oki('GET', '/ben');
echo $c['isletme']['ad']; // Example SMS Inc.

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).

3.Concepts

disKimlik: your customer ID

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.

Choosing the recipient

In the message, approval and verification endpoints, you specify the recipient with one of these fields:

FieldGoes toDetails
disKimlikThe customer card with this IDIf 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.
telefonThe user who verified this phone in OkiWith 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).
konusmaThe customer in this conversationThe 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.

Message types: islem, duyuru, reply

turUsed forRules
islemVerification, invoices, payment reminders / confirmations, subscription expiry warnings, welcome messages, installation / order results.Sent at any hour. 30 per customer per hour. This is the default type.
duyuruCampaigns, 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.
replyA 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: safe retries

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.

Second request with the same istemciKimligi
{"mesaj": 99812, "konusma": 8812, "disKimlik": "12345", "zaman": "2026-10-29T09:30:00.412Z", "tekrar": true}

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.

Limits

LimitValueWhen exceeded
Transactional notifications (per customer)30 per hour409 ulasilamadi, neden: sinir
Approval requests (per customer)30 per hoursame
Announcements (per customer)3 per daysame
Verification codes (per customer)5 per 10 minutes, 20 per daysame
All API messages (per business)300 per minutesame
Announcements (per business)20,000 per daysame
Announcement hours08:00–21:00 Turkey time409 ulasilamadi, neden: saat
New numbers reached by phone (per business)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 minute429 hiz_siniri (with a Retry-After header)
Media upload URLs (per business)300 per hour429 sinir
Bulk messages100 per request400 mesajlar
Customer import500 per request400 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.

Error format

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.

HTTP 409
{
  "hata": "müşteri işletmeyi engelledi",
  "kod": "ulasilamadi",
  "neden": "engelli"
}

Authentication (401), suspension (403) and internal error (500) responses may contain only hata. All codes: Errors and logs.

4.Messages

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.

Send a message

POST/v1/api/mesaj

Sends a transactional notification, an announcement or a reply in a conversation to a single customer.

Request fields

FieldTypeRequiredDescription
disKimlikstringone ofYour own customer ID (1–128; letters, digits, . _ : @ -). See choosing the recipient.
telefonstringone ofPhone number with country code, e.g. 905321234567. Goes to the Oki user who has verified this phone number.
konusmaintegerone ofConversation ID (e.g. from the mesaj webhook). If given, the other two fields are ignored.
turstringoptionalislem (transactional, default) or duyuru (announcement). If you pass konusma without tur, the message counts as a reply. See message types.
metinstringtext / mediaUp to 4096 characters. In a media message it is the caption and may be left empty.
medyaobjectoptional{"nesne", "tur": "foto" | "belge", "ad"?}. nesne comes from POST /medya; ad is the document's display name (up to 120).
dugmelerarrayoptionalUp to 10 buttons. See buttons.
listeobjectoptionalA list of options (2–10). Cannot be sent together with dugmeler. See list picker.
tekSecimbooleanoptionalOnly with geri buttons: true (default) the customer can choose only once; false every tap produces a separate webhook.
sessizbooleanoptionaltrue: no notification on the phone; the message still lands in the chat.
istemciKimligistringrequired8–64 characters (letters, digits, _ -). A second request with the same value does not send a new message. See safe retries.

Example request

curl -X POST "https://okime.com/v1/api/mesaj" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "disKimlik": "12345",
  "tur": "islem",
  "metin": "Your October invoice is ready: 249.90 TL. Due 5 November.",
  "dugmeler": [
    {
      "ad": "Open invoice",
      "tur": "adres",
      "adres": "https://example.com/fatura/991"
    },
    {
      "ad": "Mark as paid",
      "tur": "geri",
      "veri": "fatura:991:odendi"
    },
    {
      "ad": "Customer service",
      "tur": "telefon",
      "numara": "+908501234567"
    }
  ],
  "istemciKimligi": "fatura-991-bildirim"
}'

Example response 200

{
  "mesaj": 99812,
  "konusma": 8812,
  "disKimlik": "12345",
  "zaman": "2026-10-29T09:30:00.412Z",
  "durum": "gonderildi"
}

Possible errors

HTTPkodWhen
400istekThe body is not JSON.
400istemci_kimligiistemciKimligi is missing or has an invalid format.
400turtur is not islem or duyuru.
400metinNeither text nor media is given, or the text exceeds 4096 characters.
400dugmelerDoes not follow the button rules (name, type or the type's field).
400medyanesne or tur is invalid.
400aliciNone of disKimlik, telefon or konusma is given.
400dis_kimlikdisKimlik has an invalid format.
400telefonThe phone number is not written with a country code.
404konusmaConversation not found.
409ulasilamadiCould not be sent; check the neden field: bagli_degil, oki_yok, engelli, kaldirdi, duyuru_kapali, sinir, saat.
403iliski_yoktur: 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.
429telefon_siniriToday's limit of new numbers (ones you have never exchanged messages with) reached by phone is used up.
429hiz_siniriThe per-minute API request limit was exceeded (applies to every endpoint).
503telefon_kapaliSending 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.

Buttons

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.

turWhat happens for the customerRequired field
adres (default)The URL opens in the browser.adres: starts with https://, up to 512 characters
geriA 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
telefonThe phone app calls this number.numara: 3–20 digits, may start with +
kopyalaThe text is copied to the clipboard (code, IBAN, coupon).metin: 1–128 characters
uygulamaThe mini app URL opens inside Oki with a signed customer identity (okiGiris).adres: starts with https://, up to 512 characters
konumAfter 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.—
takvimThe 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)
"dugmeler": [
  {"ad": "Share my location", "tur": "konum"},
  {"ad": "Add to calendar", "tur": "takvim", "takvim": {
    "baslik": "Boiler service", "bas": "2026-11-12T10:00:00+03:00",
    "bit": "2026-11-12T11:00:00+03:00", "yer": "Kadıköy, İstanbul"}}
]

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 ✓".

List picker

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.

FieldRule
liste.baslikOptional, up to 60 characters; title of the opened list.
liste.dugmeOptional, up to 24 characters; text of the button that opens the list.
liste.secenekler2–10 options. Each has ad (1–48), aciklama? (up to 72), veri? (1–64 ASCII, unique; defaults to the position number).
{
  "konusma": 8812,
  "metin": "Which delivery time suits you?",
  "liste": {
    "baslik": "Delivery time",
    "dugme": "Pick a time",
    "secenekler": [
      {"ad": "09:00–12:00", "veri": "sabah"},
      {"ad": "12:00–17:00", "aciklama": "Busiest hours", "veri": "ogle"},
      {"ad": "17:00–21:00", "veri": "aksam"}
    ]
  },
  "istemciKimligi": "teslimat-5521-saat"
}

Choice webhook

{
  "olay": "mesaj",
  "veri": {
    "mesaj": 99840, "konusma": 8812, "kanal": "oki", "disKimlik": "12345",
    "tur": "metin",
    "icerik": {
      "metin": "12:00–17:00",
      "listeYaniti": {"mesaj": 99839, "sira": 1, "ad": "12:00–17:00", "veri": "ogle"}
    }
  }
}

Older versions and fallback text

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".

Send bulk messages

POST/v1/api/mesaj/toplu

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

FieldTypeRequiredDescription
mesajlararrayrequiredAn 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"
    }
  ]
}'

Example response 200

{
  "sonuclar": [
    {
      "sira": 0,
      "httpKodu": 200,
      "mesaj": 99813,
      "konusma": 8812,
      "disKimlik": "12345",
      "zaman": "2026-10-29T10:00:01.120Z",
      "durum": "gonderildi"
    },
    {
      "sira": 1,
      "httpKodu": 409,
      "hata": "bu telefonla Oki kullanıcısı yok (SMS ile gönderin)",
      "kod": "ulasilamadi",
      "neden": "oki_yok"
    }
  ],
  "basarili": 1,
  "basarisiz": 1
}

Possible errors

HTTPkodWhen
400istekThe body is not JSON or exceeds 4 MB.
400mesajlarThe array is empty or longer than 100.

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.

Message status

GET/v1/api/mesaj/{mesaj}

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"

Example response 200

{
  "mesaj": 99812,
  "disKimlik": "12345",
  "durum": "iletildi"
}

Possible errors

HTTPkodWhen
400mesajThe ID is not a number.
404mesajThe message does not exist or was not sent via the API.

Edit a message

PATCH/v1/api/mesaj/{mesaj}

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

FieldTypeRequiredDescription
metinstringoptionalNew text (up to 4096). Cannot be empty in a message without media.
dugmelerarrayoptionalNew buttons; [] removes all buttons. When the buttons change, the customer's previous choice is cleared.
tekSecimbooleanoptionalSingle-choice setting for a message with buttons.

Example request

curl -X PATCH "https://okime.com/v1/api/mesaj/99812" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "metin": "Your October invoice is paid ✓ Thank you.",
  "dugmeler": []
}'

Example response 200

{
  "mesaj": 99812,
  "icerik": {
    "metin": "Your October invoice is paid ✓ Thank you.",
    "duzenlendi": "2026-10-29T11:02:40Z"
  },
  "durum": "duzenlendi"
}

Possible errors

HTTPkodWhen
400metinThe text exceeds 4096, or is empty in a message without media.
400dugmelerDoes not follow the button rules.
404mesajThe message does not exist or was not sent via the API.
409degismezA recalled message, an approval card or a verification code message cannot be changed.

Recall a message

DELETE/v1/api/mesaj/{mesaj}

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}.

Example request

curl -X DELETE "https://okime.com/v1/api/mesaj/99812" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "mesaj": 99812,
  "durum": "silindi"
}

Possible errors

HTTPkodWhen
400mesajThe ID is not a number.
404mesajThe message does not exist or was not sent via the API.

Sending photos and documents

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).

Get an upload URL

POST/v1/api/medya

Returns a single-use upload URL for the given size and type.

Request fields

FieldTypeRequiredDescription
boyutintegerrequiredThe exact file size in bytes. The default maximum is 50 MB; if exceeded, the error message states the current limit.
turstringrequiredfoto (photo) or belge (document).

Example request

curl -X POST "https://okime.com/v1/api/medya" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "boyut": 482133,
  "tur": "belge"
}'

Example response 200

{
  "nesne": "9f2c4e1a7b3d4c5e8f6a0b1c2d3e4f50",
  "yukleme": {
    "url": "https://depo.okime.com/y/9f2c4e1a7b3d4c5e8f6a0b1c2d3e4f50?X-Amz-Signature=…",
    "basliklar": {
      "Content-Length": "482133"
    }
  },
  "gecerlilik": 900
}

Possible errors

HTTPkodWhen
400boyutboyut is missing, zero or exceeds the limit.
400turtur is not foto or belge.

Upload and send

Send the file to yukleme.url with PUT, adding the headers from yukleme.basliklar exactly 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) {
    throw new 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',
]);

5.Approval requests

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.

Flow

  1. Send the request with POST /onay; save the onay ID from the response.
  2. The customer sees the card: title, text, detail rows and two buttons.
  3. When the customer decides, the onay webhook arrives: karar = onaylandi or reddedildi.
  4. If it expires (checked once a minute), you receive karar: suresi_doldu. If you don't use webhooks, query it with GET /onay/{id}.
  5. To withdraw, call DELETE /onay/{id}: the customer's card shows "cancelled" (no webhook is sent).

Send an approval request

POST/v1/api/onay

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.

Request fields

FieldTypeRequiredDescription
disKimlikstringone ofYour customer ID (1–128; letters, digits, . _ : @ -). See choosing the recipient.
telefonstringone ofPhone number with country code, e.g. 905321234567. Goes to the Oki user who has verified this phone number.
konusmaintegerone ofConversation ID (e.g. from the mesaj webhook). If given, the other two fields are ignored.
baslikstringoptionalCard title, up to 80 characters.
metinstringrequiredCard text, 1–2000 characters.
ayrintiarrayoptionalUp to 10 rows: {"ad": 1–40, "deger": up to 200}. Shown on the card as a name / value table.
onayAdstringoptionalLabel of the approve button (default Onayla, up to 24).
retAdstringoptionalLabel of the decline button (default Reddet, up to 24).
sureintegeroptionalValidity in minutes: 1–10080 (7 days). Default 1440 (24 hours).
sessizbooleanoptionaltrue: no notification is shown.
istemciKimligistringrequired8–64 characters; a second request with the same value returns the first approval request.

Example request

curl -X POST "https://okime.com/v1/api/onay" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "disKimlik": "12345",
  "baslik": "Campaign approval",
  "metin": "Your ORNEKMARKA campaign is ready to send. Do you approve?",
  "ayrinti": [
    {
      "ad": "Recipients",
      "deger": "12,500 people"
    },
    {
      "ad": "Send time",
      "deger": "29 October 14:00"
    },
    {
      "ad": "Amount",
      "deger": "1,875.00 TL"
    }
  ],
  "onayAd": "Send",
  "retAd": "Cancel",
  "sure": 30,
  "istemciKimligi": "kampanya-4471-onay"
}'

Example response 200

{
  "onay": "onay_5b0e9c2f7a1d4e8b3c6f9a01",
  "mesaj": 99820,
  "disKimlik": "12345",
  "durum": "bekliyor",
  "bitis": "2026-10-29T10:30:00Z"
}

Possible errors

HTTPkodWhen
400istemci_kimligiistemciKimligi is missing or invalid.
400metinText is empty or longer than 2000 characters, or the title is longer than 80.
400ayrintiMore than 10 rows, or a name / value is too long.
400dugmeleronayAd / retAd is longer than 24 characters.
400suresure is outside 1–10080.
409oki_gerekThe recipient is a visitor who writes only via the web widget; an approval card can't be sent.
400aliciNo disKimlik, telefon or konusma given.
400dis_kimlikInvalid disKimlik format.
400telefonPhone number is missing the country code.
404konusmaConversation not found.
409ulasilamadiCould not be sent; check the neden field: bagli_degil, oki_yok, engelli, kaldirdi, duyuru_kapali, sinir, saat.
503telefon_kapaliSending by phone number is temporarily unavailable.

Approval status

GET/v1/api/onay/{onay}

durum: bekliyor, onaylandi, reddedildi, suresi_doldu or iptal. karar is the time of the decision (or of the cancellation / expiry).

Example request

curl -X GET "https://okime.com/v1/api/onay/onay_5b0e9c2f7a1d4e8b3c6f9a01" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "onay": "onay_5b0e9c2f7a1d4e8b3c6f9a01",
  "mesaj": 99820,
  "disKimlik": "12345",
  "durum": "onaylandi",
  "bitis": "2026-10-29T10:30:00Z",
  "karar": "2026-10-29T10:04:12Z",
  "olusturma": "2026-10-29T10:00:00Z"
}

Possible errors

HTTPkodWhen
404onayApproval request not found.

Cancel an approval request

DELETE/v1/api/onay/{onay}

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.

Example request

curl -X DELETE "https://okime.com/v1/api/onay/onay_5b0e9c2f7a1d4e8b3c6f9a01" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "onay": "onay_5b0e9c2f7a1d4e8b3c6f9a01",
  "durum": "iptal"
}

Possible errors

HTTPkodWhen
404onayApproval request not found.
409onay_bittiThe request is no longer pending; the body contains durum (e.g. onaylandi).

6.Verification code

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 ]

Send a verification code

POST/v1/api/dogrulama

The code message is always sent with a notification. The code is not returned in the response; to check it, use the check endpoint.

Request fields

FieldTypeRequiredDescription
disKimlikstringone ofYour customer ID (1–128; letters, digits, . _ : @ -). See choosing the recipient.
telefonstringone ofPhone number with country code, e.g. 905321234567. Goes to the Oki user who has verified this phone number.
kodstringoptionalYour own code: 4–10 digits. If omitted, Oki generates one.
uzunlukintegeroptionalNumber of digits in the code Oki generates: 4–10 (default 6).
sureintegeroptionalValidity in seconds: 60–1800 (default 300).
uygulamastringoptionalName shown in the message (up to 40), e.g. Example SMS. If omitted, the business name is used.
istemciKimligistringoptional8–64 characters. If you set it, a second request with the same value doesn't send a second code; it returns the first one.

Example request

curl -X POST "https://okime.com/v1/api/dogrulama" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "telefon": "905321234567",
  "uygulama": "Example SMS",
  "uzunluk": 6,
  "sure": 300,
  "istemciKimligi": "giris-a81f3c2d"
}'

Example response 200

{
  "dogrulama": "dg_3e7a9c1b5d2f4e6a8c0b2d4f",
  "mesaj": 99830,
  "disKimlik": "",
  "durum": "gonderildi",
  "bitis": "2026-10-29T09:35:00Z"
}

Possible errors

HTTPkodWhen
400kodCode is not 4–10 digits.
400uzunlukOutside 4–10.
400sureOutside 60–1800.
400uygulamaLonger than 40 characters.
400istemci_kimligiInvalid format.
400aliciNo disKimlik, telefon or konusma given.
400dis_kimlikInvalid disKimlik format.
400telefonPhone number is missing the country code.
409ulasilamadioki_yok (phone number not on Oki), engelli, kaldirdi, bagli_degil or sinir (5 per 10 minutes / 20 per day). Fall back to SMS.
503telefon_kapaliSending by phone number is temporarily unavailable; fall back to SMS.

disKimlik in the response is filled if the customer's card has your ID; it is empty only for a customer reached by phone number who has no ID.

Check the code

POST/v1/api/dogrulama/{dogrulama}/kontrol

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.

Request fields

FieldTypeRequiredDescription
kodstringrequiredThe code the user entered.

Example request

curl -X POST "https://okime.com/v1/api/dogrulama/dg_3e7a9c1b5d2f4e6a8c0b2d4f/kontrol" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "kod": "482913"
}'

Example response 200

{
  "gecerli": true,
  "durum": "dogrulandi",
  "kalanDeneme": 5
}

Possible errors

HTTPkodWhen
400kodCode is longer than 20 characters.
404dogrulamaVerification not found.
durumgecerliMeaning
dogrulanditrueCode is correct; verification complete. Later checks on the same verification return gecerli: false and durum: dogrulandi.
yanlisfalseWrong code; kalanDeneme attempts remain.
deneme_bittifalse5 wrong attempts; this verification can no longer be used. Send a new code.
suresi_doldufalsebitis has passed. Send a new code.

Recommended flow: Oki first, SMS as fallback

  1. The user enters their phone number. Send a code from Oki with POST /dogrulama.
  2. On 200, show "We sent the code to Oki" and store the dogrulama ID in the session. Also show a "Didn't get the code? Send by SMS" link.
  3. On 409 (oki_yok, engelli, kaldirdi…) or 503, send by SMS right away.
  4. When the user enters the code, call POST /dogrulama/{id}/kontrol; if gecerli: true, continue.
// 1) Send the code
[$kod, $c] = oki('POST', '/dogrulama', [
    'telefon'        => $telefon,            // e.g. '905321234567'
    'uygulama'       => 'Example SMS',
    'istemciKimligi' => 'giris-' . session_id(),
]);
if ($kod === 200) {
    $_SESSION['oki_dogrulama'] = $c['dogrulama'];
    $_SESSION['kanal'] = 'oki';              // "We sent the code to Oki"
} else {
    // oki_yok, engelli, kaldirdi, sinir, telefon_kapali… → SMS
    $_SESSION['sms_kodu'] = (string) random_int(100000, 999999);
    $_SESSION['kanal'] = 'sms';
    smsGonder($telefon, 'Your Example SMS verification code: ' . $_SESSION['sms_kodu']);
}

// 2) When the user enters the code
if ($_SESSION['kanal'] === 'oki') {
    [$kod, $s] = oki('POST', '/dogrulama/' . $_SESSION['oki_dogrulama'] . '/kontrol', ['kod' => $_POST['kod']]);
    $gecti = $kod === 200 && $s['gecerli'];
    if (!$gecti && ($s['durum'] ?? '') === 'yanlis') {
        $uyari = "Wrong code. Attempts left: {$s['kalanDeneme']}";
    }
} else {
    $gecti = hash_equals($_SESSION['sms_kodu'], $_POST['kod']);
}

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.

7.Customers and fields

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.

Add / update customers

POST/v1/api/musteriler

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

FieldTypeRequiredDescription
musterilerarrayrequiredCustomer objects; disKimlik is required in each, other fields below.
alanOlusturbooleanoptionaltrue: 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[].disKimlikstringrequiredYour customer ID.
musteriler[].adstringoptionalDisplay name, at most 64 characters.
musteriler[].telefonstringoptionalWith 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[].epostastringoptionalStored in the eposta field.
musteriler[].alanlarobjectoptionalKey → value (at most 100). The value must match the field's type; an empty value ("" or null) clears the field.
musteriler[].etiketlerstring[]optionalReplaces all tags with this list (each at most 30 characters, at most 20 tags).
musteriler[].etiketEklestring[]optionalAdds to the existing tags.
musteriler[].etiketCikarstring[]optionalRemoves from the existing tags.

Example request

curl -X POST "https://okime.com/v1/api/musteriler" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "alanOlustur": true,
  "musteriler": [
    {
      "disKimlik": "12345",
      "ad": "Ayşe Yılmaz",
      "telefon": "905321234567",
      "eposta": "[email protected]",
      "alanlar": {
        "paket": "Gold",
        "bakiye": 125.5,
        "son_odeme": "2026-11-05"
      },
      "etiketler": [
        "vip"
      ]
    },
    {
      "disKimlik": "12346",
      "ad": "Mehmet Demir",
      "telefon": "905339876543",
      "etiketEkle": [
        "yeni"
      ]
    }
  ]
}'

Example response 200

{
  "sonuclar": [
    {
      "disKimlik": "12345",
      "durum": "eklendi",
      "musteri": 77
    },
    {
      "disKimlik": "12346",
      "durum": "guncellendi",
      "musteri": 78
    }
  ],
  "eklenen": 1,
  "guncellenen": 1,
  "hatali": 0
}

Possible errors

HTTPkodWhen
400istekBody is not JSON or exceeds 8 MB.
400musterilerArray is empty or longer than 500.

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.

List customers

GET/v1/api/musteriler

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

FieldTypeRequiredDescription
etiketstringoptionalOnly customers with this tag.
arastringoptionalSearches names, disKimlik and field values (case-insensitive).
sonraintegeroptionalThe sonraki value from the previous response.
sinirintegeroptionalPage 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"

Example response 200

{
  "musteriler": [
    {
      "id": 77,
      "disKimlik": "12345",
      "ad": "Ayşe Yılmaz",
      "alanlar": {
        "telefon": "+905321234567",
        "eposta": "[email protected]",
        "paket": "Gold",
        "bakiye": 125.5,
        "son_odeme": "2026-11-05"
      },
      "etiketler": [
        "vip"
      ],
      "oki": true,
      "bagli": false,
      "duyuruKapali": false,
      "engelledi": false,
      "konusma": 8812,
      "olusturma": "2026-10-29T08:12:03Z",
      "guncelleme": "2026-10-29T09:30:00Z"
    }
  ],
  "sonraki": null
}
FieldMeaning
idCustomer card ID in Oki (musteri in webhooks).
okiThe card has an Oki account (the customer can write from the app, and your messages reach them).
bagliThe customer approved account linking.
duyuruKapaliThe customer turned off announcements; transactional notifications are still delivered.
engellediThe customer blocked the business; no messages are delivered.
konusmaThe customer's conversation (null if none).

Get a customer

GET/v1/api/musteriler/{disKimlik}

A customer card by disKimlik. The response is the same object as in the list.

Example request

curl -X GET "https://okime.com/v1/api/musteriler/12345" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "id": 77,
  "disKimlik": "12345",
  "ad": "Ayşe Yılmaz",
  "alanlar": {
    "telefon": "+905321234567",
    "eposta": "[email protected]",
    "paket": "Gold",
    "bakiye": 125.5,
    "son_odeme": "2026-11-05"
  },
  "etiketler": [
    "vip"
  ],
  "oki": true,
  "bagli": false,
  "duyuruKapali": false,
  "engelledi": false,
  "konusma": 8812,
  "olusturma": "2026-10-29T08:12:03Z",
  "guncelleme": "2026-10-29T09:30:00Z"
}

Possible errors

HTTPkodWhen
404musteriNo customer with this ID.

Update a customer

PATCH/v1/api/musteriler/{disKimlik}

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

FieldTypeRequiredDescription
adstringoptionalDisplay name, at most 64 characters.
telefonstringoptionalWith 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.
epostastringoptionalStored in the eposta field.
alanlarobjectoptionalKey → value (at most 100). The value must match the field's type; an empty value ("" or null) clears the field.
etiketlerstring[]optionalReplaces all tags with this list (each at most 30 characters, at most 20 tags).
etiketEklestring[]optionalAdds to the existing tags.
etiketCikarstring[]optionalRemoves from the existing tags.
alanOlusturbooleanoptionalAutomatically create undefined fields.

Example request

curl -X PATCH "https://okime.com/v1/api/musteriler/12345" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "alanlar": {
    "bakiye": 0
  },
  "etiketEkle": [
    "odedi"
  ],
  "etiketCikar": [
    "borclu"
  ]
}'

Example response 200

{
  "id": 77,
  "disKimlik": "12345",
  "ad": "Ayşe Yılmaz",
  "alanlar": {
    "telefon": "+905321234567",
    "eposta": "[email protected]",
    "paket": "Gold",
    "bakiye": 125.5,
    "son_odeme": "2026-11-05"
  },
  "etiketler": [
    "vip"
  ],
  "oki": true,
  "bagli": false,
  "duyuruKapali": false,
  "engelledi": false,
  "konusma": 8812,
  "olusturma": "2026-10-29T08:12:03Z",
  "guncelleme": "2026-10-29T09:30:00Z"
}

Possible errors

HTTPkodWhen
400musteriA name, phone, tag or field-count rule was violated.
400alanUnknown field or value not matching the type.
404musteriNo customer with this ID.

Delete a customer

DELETE/v1/api/musteriler/{disKimlik}

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.

Example request

curl -X DELETE "https://okime.com/v1/api/musteriler/12345" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "disKimlik": "12345",
  "durum": "temizlendi"
}

Possible errors

HTTPkodWhen
404musteriNo customer with this ID.

Customer fields

Fields are the columns on the customer card (Customer fields in the dashboard). Types:

turValueRule
metinstringAt most 500 characters.
uzun_metinstringAt most 4,000 characters.
telefonstringDigits, spaces, + ( ) -; 3–24 characters.
epostastringMust contain @, no spaces.
sayinumberNumber.
paranumberNumber (amount).
tarihstringYYYY-AA-GG (YYYY-MM-DD), e.g. 2026-11-05.
secimstringOne of secenekler.
coklu_secimstring[]One or more of secenekler.
evet_hayirbooleantrue / false.

List fields

GET/v1/api/alanlar

Defined fields and available types.

Example request

curl -X GET "https://okime.com/v1/api/alanlar" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "alanlar": [
    {
      "anahtar": "telefon",
      "ad": "Phone",
      "tur": "telefon",
      "secenekler": [],
      "zorunlu": false,
      "etkin": true
    },
    {
      "anahtar": "paket",
      "ad": "Package",
      "tur": "secim",
      "secenekler": [
        "Silver",
        "Gold",
        "Platinum"
      ],
      "zorunlu": false,
      "etkin": true
    }
  ],
  "turler": [
    "metin",
    "uzun_metin",
    "telefon",
    "eposta",
    "sayi",
    "para",
    "tarih",
    "secim",
    "coklu_secim",
    "evet_hayir"
  ]
}

Add a field

POST/v1/api/alanlar

Defines a new customer field; the field is added as active.

Request fields

FieldTypeRequiredDescription
anahtarstringrequiredStarts with a lowercase letter; a-z 0-9 _, at most 40. Cannot be changed later.
adstringrequiredDisplay name, 1–40 characters.
turstringrequiredOne of the types above.
seceneklerstring[]for secimFor secim / coklu_secim, 1–50 options (each at most 60).
zorunlubooleanoptionaltrue: this field cannot be left empty (including in imports).

Example request

curl -X POST "https://okime.com/v1/api/alanlar" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "anahtar": "paket",
  "ad": "Package",
  "tur": "secim",
  "secenekler": [
    "Silver",
    "Gold",
    "Platinum"
  ]
}'

Example response 200

{
  "alan": {
    "anahtar": "paket",
    "ad": "Package",
    "tur": "secim",
    "secenekler": [
      "Silver",
      "Gold",
      "Platinum"
    ],
    "zorunlu": false,
    "etkin": true
  }
}

Possible errors

HTTPkodWhen
400alanThe key is invalid or already exists, a name / type / option rule was violated, or the field limit (at most 60 fields) has been reached.

8.Account linking

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.

A — By phone (via sign-up / dashboard)

  • 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).

Send a linking request

POST/v1/api/baglama

Sends the customer a linking confirmation card. The result arrives via the baglandi / baglanmadi webhook.

Request fields

FieldTypeRequiredDescription
disKimlikstringrequiredYour customer ID.
telefonstringone ofPhone number with country code (path A).
konusmaintegerone ofConversation of a customer writing from the Oki app (path B).

Example request

curl -X POST "https://okime.com/v1/api/baglama" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "disKimlik": "12345",
  "telefon": "905321234567"
}'

Example response 202

{
  "istek": "4f1c9a2e7b3d5e8f0a1b2c3d",
  "disKimlik": "12345",
  "durum": "bekliyor"
}

Possible errors

HTTPkodWhen
400istekThe body is not JSON.
400dis_kimlikdisKimlik missing or invalid.
400telefonInvalid phone, or neither phone nor conversation given.
404konusmaThe conversation does not exist or does not belong to a customer writing from the Oki app.
503telefon_kapaliLinking by phone is temporarily unavailable.

Linking status

GET/v1/api/baglama/{istek}

durum: bekliyor, baglandi or baglanmadi. A negative result shows as bekliyor until 24 hours have passed.

Example request

curl -X GET "https://okime.com/v1/api/baglama/4f1c9a2e7b3d5e8f0a1b2c3d" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "istek": "4f1c9a2e7b3d5e8f0a1b2c3d",
  "disKimlik": "12345",
  "durum": "baglandi"
}

Possible errors

HTTPkodWhen
404istekRequest not found.

Customer side

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.

9.Conversations and bots

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}.

List conversations

GET/v1/api/konusmalar

Newest first, by last message time. To paginate, send the oncesi and oncesiId values from the sonraki object in the response.

Query parameters

FieldTypeRequiredDescription
filtrestringoptionalhepsi (default; excludes closed), atanmamis or kapali.
oncesistringoptionalRFC 3339 time; sonraki.oncesi from the previous page.
oncesiIdintegeroptionalsonraki.oncesiId from the previous page.
sinirintegeroptional1–200 (default 50).

Example request

curl -X GET "https://okime.com/v1/api/konusmalar?filtre=atanmamis" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "konusmalar": [
    {
      "id": 8812,
      "kanal": "oki",
      "durum": "acik",
      "konu": "",
      "musteri": {
        "id": 77,
        "ad": "Ayşe Yılmaz",
        "disKimlik": "12345"
      },
      "atanan": "",
      "atananAd": "",
      "okunmamis": 1,
      "sonMesajZamani": "2026-10-29T09:41:07Z",
      "sonMesajOzet": "Hi, I have a question about my invoice",
      "olusturma": "2026-10-29T08:12:03Z",
      "yanitBekliyor": "2026-10-29T09:41:07Z"
    }
  ],
  "sonraki": null
}

Possible errors

HTTPkodWhen
400oncesioncesi is not RFC 3339.
FieldMeaning
kanaloki (app) or web (support widget).
durumacik, beklemede or kapali. Conversations opened by the API that the customer has not replied to yet are kapali.
konuSupport topic chosen by the customer (empty: none chosen).
atananOki number of the assigned agent (empty: unassigned); atananAd is their display name.
yanitBekliyorTime of the customer's first unanswered message (null once replied to).

Get a conversation

GET/v1/api/konusmalar/{konusma}

Same object as in the list.

Example request

curl -X GET "https://okime.com/v1/api/konusmalar/8812" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "id": 8812,
  "kanal": "oki",
  "durum": "acik",
  "konu": "",
  "musteri": {
    "id": 77,
    "ad": "Ayşe Yılmaz",
    "disKimlik": "12345"
  },
  "atanan": "",
  "atananAd": "",
  "okunmamis": 1,
  "sonMesajZamani": "2026-10-29T09:41:07Z",
  "sonMesajOzet": "Hi, I have a question about my invoice",
  "olusturma": "2026-10-29T08:12:03Z",
  "yanitBekliyor": "2026-10-29T09:41:07Z"
}

Possible errors

HTTPkodWhen
400konusmaThe ID is not a number.
404konusmaConversation not found.

Status and assignment

PUT/v1/api/konusmalar/{konusma}

Changes the conversation's status and / or assignee. The response is the updated conversation.

Request fields

FieldTypeRequiredDescription
durumstringoptionalacik, beklemede or kapali.
atananstringoptionalOki number of a member of your team; "" returns the conversation to the pool.

Example request

curl -X PUT "https://okime.com/v1/api/konusmalar/8812" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{
  "atanan": "73950418226"
}'

Example response 200

{
  "id": 8812,
  "kanal": "oki",
  "durum": "acik",
  "konu": "",
  "musteri": {
    "id": 77,
    "ad": "Ayşe Yılmaz",
    "disKimlik": "12345"
  },
  "atanan": "73950418226",
  "atananAd": "Support · Elif",
  "okunmamis": 1,
  "sonMesajZamani": "2026-10-29T09:41:07Z",
  "sonMesajOzet": "Hi, I have a question about my invoice",
  "olusturma": "2026-10-29T08:12:03Z",
  "yanitBekliyor": "2026-10-29T09:41:07Z"
}

Possible errors

HTTPkodWhen
400durumInvalid status.
404konusmaConversation not found.
404atananNo active member with this number.
409atananConversations cannot be assigned to this person.

Conversation messages

GET/v1/api/konusmalar/{konusma}/mesajlar

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

FieldTypeRequiredDescription
oncesiintegeroptionalMessages older than this message ID.
sinirintegeroptional1–200 (default 50).

Example request

curl -X GET "https://okime.com/v1/api/konusmalar/8812/mesajlar?sinir=50" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "mesajlar": [
    {
      "id": 99841,
      "konusma": 8812,
      "yon": "giden",
      "tur": "metin",
      "icerik": {
        "metin": "Hi Ayşe, I'm looking into it right away."
      },
      "uye": "",
      "uyeAd": "",
      "istemciKimligi": "api-bot-8812-99840",
      "zaman": "2026-10-29T09:41:09Z"
    },
    {
      "id": 99840,
      "konusma": 8812,
      "yon": "gelen",
      "tur": "metin",
      "icerik": {
        "metin": "Hi, I have a question about my invoice"
      },
      "uye": "",
      "uyeAd": "",
      "istemciKimligi": "c-7d1e…",
      "zaman": "2026-10-29T09:41:07Z"
    }
  ]
}

Possible errors

HTTPkodWhen
404konusmaConversation not found.

Reply to a conversation

POST/v1/api/konusmalar/{konusma}/mesaj

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.

Request fields

FieldTypeRequiredDescription
metinstringtext / mediaAt most 4096.
medyaobjectoptionalSee media.
dugmelerarrayoptionalSee buttons.
sessizbooleanoptionalNo notification is shown.
istemciKimligistringrequired8–64 characters.

Example request

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"
}'

Example response 200

{
  "mesaj": 99841,
  "konusma": 8812,
  "disKimlik": "12345",
  "zaman": "2026-10-29T09:41:09Z",
  "durum": "gonderildi"
}

Possible errors

HTTPkodWhen
400konusmaThe ID is not a number.
400istemci_kimligiMissing or invalid.
400metinText / media missing or too long.
404konusmaConversation not found.
409ulasilamadiengelli (the customer blocked you) or sinir.

Mark as read

POST/v1/api/konusmalar/{konusma}/okundu

Marks the customer's messages in the conversation as read; a customer in the Oki app sees that their messages have been read.

Example request

curl -X POST "https://okime.com/v1/api/konusmalar/8812/okundu" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "konusma": 8812,
  "okunmamis": 0
}

Possible errors

HTTPkodWhen
404konusmaConversation not found.

10.Webhook

Setup

  1. In the dashboard, API and integration → Webhook URL: a URL on your server starting with https:// (e.g. https://example.com/oki/webhook).
  2. 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).
  3. 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"}
FieldTypeRequiredDescription
adresstringnoURL starting with https:// (up to 500 characters). An empty string turns the webhook off.
sirYenilebooleannotrue: 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.

Request format

Each event is a POST request to your URL:

POST /oki/webhook HTTP/1.1
Content-Type: application/json
User-Agent: Oki-Webhook/1
Oki-Olay: dugme
Oki-Teslim: 5521
Oki-Imza: t=1730194869,v1=5f2b9c…e41a

{"id": 5521, "olay": "dugme", "zaman": "2026-10-29T09:41:09.204Z",
 "veri": {"mesaj": 99812, "konusma": 8812, "disKimlik": "12345",
          "dugme": {"sira": 1, "ad": "Mark as paid", "veri": "fatura:991:odendi"},
          "zaman": "2026-10-29T09:41:09.201Z"}}
Field / headerMeaning
id / Oki-TeslimDelivery ID. It stays the same when the same event is retried: use it to deduplicate.
olay / Oki-OlayEvent name (see the table below).
zamanWhen the event occurred. Order is not guaranteed; use this field to sort.
veriEvent-specific fields.
Oki-Imzat=<unix seconds>,v1=<hex>; v1 = HMAC-SHA256(secret, "<t>.<raw body>").

Response and retries

  • 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.

Verifying signatures

Verify the signature against the raw body (before parsing the JSON), using a constant-time comparison.

<?php
$sir   = getenv('OKI_WEBHOOK_SIRRI');           // oks_…
$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);
// The same event may arrive twice: skip it if already processed.
// (e.g. MySQL: INSERT IGNORE INTO oki_olaylar (id) VALUES (?) and exit if 0 rows affected)

switch ($olay['olay']) {
    case 'mesaj':      // customer wrote → forward to your bot
        break;
    case 'dugme':      // $olay['veri']['dugme']['veri'] → e.g. "fatura:991:odendi"
        break;
    case 'onay':       // $olay['veri']['karar'] → onaylandi / reddedildi / suresi_doldu
        break;
    case 'iletildi':   // cancel the pending SMS fallback
        break;
    case 'baglanti_kaldirildi':
        // send notifications via SMS again
        break;
}
http_response_code(200);

Events

olayveriWhen
siparissiparis, durum, toplamKurus, disKimlikAn order was placed or its status changed (Catalog & orders).
randevurandevu, durum, hizmet, baslangic, disKimlikA booking was created or its status changed (Appointments).
denememetin"Send test" in the dashboard, or POST /webhooklar/deneme.
baglandiistek, disKimlik, musteriThe customer approved the linking request (or was already linked).
baglanmadiistek, disKimlik24 hours passed without linking (no account / declined / no response).
baglanti_kaldirildidisKimlikA linked customer removed the link or blocked the business.
duyuru_kapatildidisKimlikA linked customer turned off announcements.
duyuru_acildidisKimlikA linked customer turned announcements back on.
iletildimesaj, disKimlik, zamanA message you sent via the API (notification, reply, approval, verification) reached the customer's phone.
okundumesaj, disKimlik, zamanThe customer read your API message (a separate event for each message read).
mesajmesaj, konusma, kanal, disKimlik, ad, tur, icerik, zamanThe 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 tur foto / video / ses / belge.
dugmemesaj, konusma, disKimlik, dugme {sira, ad, veri}, zamanThe customer tapped a geri (callback) button.
santral_sorgusorgu, sorguId, musteri, numara, disKimlik, bagli, ad, girdi, dil, denemeA caller pressed a query key in the switchboard; expects a JSON answer within 5 seconds and is not retried (Switchboard queries).
onayonay, mesaj, disKimlik, karar, zamanThe 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).

Example: onay

{
  "id": 5534,
  "olay": "onay",
  "zaman": "2026-10-29T10:04:12.310Z",
  "veri": {
    "onay": "onay_5b0e9c2f7a1d4e8b3c6f9a01",
    "mesaj": 99820,
    "disKimlik": "12345",
    "karar": "onaylandi",
    "zaman": "2026-10-29T10:04:12.305Z"
  }
}

Webhook history and resending

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.

Recent webhooks

GET/v1/api/webhooklar

Recent deliveries, newest first; sonHata is the reason for the last failed attempt (e.g. HTTP 500).

Query parameters

FieldTypeRequiredDescription
sinirintegeroptional1–200 (default 50).

Example request

curl -X GET "https://okime.com/v1/api/webhooklar?sinir=50" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "webhooklar": [
    {
      "id": 5534,
      "olay": "onay",
      "veri": {
        "onay": "onay_5b0e9c2f7a1d4e8b3c6f9a01",
        "mesaj": 99820,
        "disKimlik": "12345",
        "karar": "onaylandi",
        "zaman": "2026-10-29T10:04:12.305Z"
      },
      "durum": "vazgecildi",
      "deneme": 12,
      "sonHata": "HTTP 502",
      "olusturma": "2026-10-28T10:04:12.310Z"
    }
  ]
}

Send a test event

POST/v1/api/webhooklar/deneme

Queues a deneme event ({"metin": "Oki webhook denemesi"}); it reaches your URL within a few seconds.

Example request

curl -X POST "https://okime.com/v1/api/webhooklar/deneme" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Example response 200

{
  "tamam": true
}

Possible errors

HTTPkodWhen
409webhook_yokNo webhook URL is set in the dashboard.

Resend

POST/v1/api/webhooklar/{webhook}/yeniden

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"

Example response 200

{
  "tamam": true
}

Possible errors

HTTPkodWhen
400webhookThe ID is not a number.
404webhookWebhook not found, or no webhook URL is set.

11.Authenticated support widget

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.

  1. In the Oki Business dashboard, Web support widget: allow your domain (e.g. example.com) and turn the widget on.
  2. 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).
  3. Sign when rendering your customer portal page and put the values in the script tag.
<?php
$t = time();
$imza = hash_hmac('sha256',
    $t . '.' . $musteri['id'] . '.' . $musteri['ad'] . '.' . $musteri['eposta'],
    getenv('OKI_KIMLIK_SIRRI'));
?>
<script src="https://okime.com/w.js?v=2" data-oki="<WIDGET ID>" async
  data-kimlik="<?= htmlspecialchars($musteri['id']) ?>"
  data-ad="<?= htmlspecialchars($musteri['ad']) ?>"
  data-eposta="<?= htmlspecialchars($musteri['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.

From the customer card to your portal: card URL

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.

Appointments

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.

EndpointDescription
GET /randevu-hizmetleriSettings (acik, onayGerekli, enErkenDk, enGecGun, iptalSinirSaat, hatirlatmaSaat) and services (id, ad, sureDk, kapasite, saatler).
GET /randevular?bas=&bit=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.
PUT /randevular/{id}{"durum"}: bekliyor → onaylandi | iptal, onaylandi → iptal | geldi | gelmedi; an invalid transition returns 409 durum.

Webhook event randevu: randevu, durum, hizmet, baslangic, bitis, kaynak (musteri | personel | api), disKimlik. Sent when a booking is created and on every status change.

OkiMe Switchboard (voice menu)

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.

EndpointDescription
GET /santralsantral {acik, ayar, surum}, birimler (id, ad, uyeler), uyeler (members who can take calls: numara, ad, mola), ozet (last 24 hours: cagri, gorusulen, kacan, ortBekleSn, ortKonusSn, mesajIstegi), kuyruk (live queue), mesaiIcinde.
PUT /santral{"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:

FieldDescription
dilReading language (tr, en, de…). If an option has no text, the prompt is built automatically in tr / en.
seskadin (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}.
karsilamaGreeting 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.
mesaiDisi{"metin", "eylem": "mesaj" | "geri_arama" | "birim" | "kapat", "birim"}.
varsayilanBirimTeam for calls from (older) app versions that don't show the menu; if empty, the usual routing (assigned agent, then team).
beklemeanonsSn (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.

Switchboard queries (CRM data)

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.

What it is for

SectorExample keyWhat arrives in the chat
Payments / wallet"For your balance, press 1" (with PIN)Current balance and the last three transactions
Gaming / loyaltyBonus, points, withdrawal status"Your withdrawal was approved and will reach your account within 2 business days."
Subscriptions / utilitiesLatest invoiceAmount, due date and a payment link in the text
E-commerce / deliveryOrder status (with order number)"Your order has shipped, tracking no. …"
Retail / marketingYour personal offersCampaigns and codes assigned to the customer
Health / servicesAppointment or service ticketDate and status of the record

The query finishes without an agent: after the confirmation the caller is back in the main menu and can press another key.

Setup, step by step

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.

  1. 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.
  2. 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).
  3. 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.
  4. 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.
  5. 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):

FieldTypeRequiredDescription
kodstringrequired2–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.
adstringrequired1–60 characters. The name shown in the editor and on the Switchboard queries page ("Balance"). Not read to the caller.
aciklamastringoptionalUp to 300 characters; a note for your team.
kimlikstringrequiredoki: 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.
girdistringrequiredyok: 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.
girdiMetnistringrequired if rakamUp to 300 characters. Read (and voiced) before the digits are requested: "Please enter your four-digit PIN, then press hash."
girdiUzunlukintegerrequired if rakam1–16: the maximum number of digits. Once that many digits are typed the request goes without waiting for #; a shorter entry ends with #.
anonsstringoptionalUp 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.
aktifbooleanoptionalDefault 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.

Identity and verification

There are three ways to establish who is calling; you can combine them in one block.

ModeBlock settingHow it worksWhen to use
Directly by Oki numberkimlik: "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 onlykimlik: "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 inputgirdi: "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.

Security

  • 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.

The request from Oki

When the caller presses the key (and types the digits, if any), Oki sends this request to your webhook address:

POST /oki/webhook HTTP/1.1
Content-Type: application/json
User-Agent: Oki-Webhook/1
Oki-Olay: santral_sorgu
Oki-Teslim: sq_8f2c4d1e9a7b3c5d
Oki-Imza: t=1762596000,v1=9c41e2…7d0b

{"id": "sq_8f2c4d1e9a7b3c5d", "olay": "santral_sorgu", "zaman": "2026-11-08T10:00:00.120Z",
 "veri": {"sorgu": "bakiye", "sorguId": "sq_8f2c4d1e9a7b3c5d",
          "musteri": 77, "numara": "9012345678",
          "disKimlik": "12345", "bagli": true, "ad": "Ayşe Yılmaz",
          "girdi": "1234", "dil": "tr", "deneme": false}}
HeaderMeaning
Oki-Olay: santral_sorguEvent name. Other events arrive at the same address, so branch your handler on it.
Oki-TeslimThe query ID (sorguId; a string starting with sq_, not a number as in other events). You use it for a deferred reply.
Oki-Imzat=<unix seconds>,v1=<hex>; v1 = HMAC-SHA256(secret, "<t>.<raw body>"). Same as Verifying signatures.

veri fields:

FieldTypeDescription
sorgustringThe block's kod (e.g. bakiye). Tells you which information is wanted.
sorguIdstringUnique ID of this query; equal to id and Oki-Teslim. Keep it when you answer sonra.
musteriintegerThe customer's ID in Oki; the same musteri as in other webhooks.
numarastringThe 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.
disKimlikstringYour customer ID if the customer has linked their account; otherwise an empty string.
baglibooleanWhether the customer is linked to you. Always true for kimlik: "bagli" blocks.
adstringThe name on your customer card (may be empty). Do not use it for verification.
girdistringThe digits the caller typed (without #); an empty string for girdi: "yok" blocks. Never log it.
dilstringThe switchboard's spoken language (tr, en, de…). Write mesaj and anons in this language.
denemebooleantrue when sent with Test from the dashboard or the API: your answer is not delivered, do not perform side effects.

Your response

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."}
FieldTypeRequiredDescription
durumstringrequiredOne of the values in the table below.
mesajstringoptionalUp 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.
anonsstringoptionalUp 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.
durumWhat Oki doesWhat the caller hears (without anons)
tamamSends 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."
sonraSends 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."
dogrulanamadiCounts 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)
bulunamadiSends nothing."We could not find your record."
hataSends 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.

Deferred reply (sonra)

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).

Deferred reply to a query

POST/v1/api/santral/sorgu/{sorguId}/yanit

The message is sent from your business profile to the customer's chat. Each query can be answered once.

Request fields

FieldTypeRequiredDescription
mesajstringrequired1–2000 characters, plain text.

Example request

curl -X POST "https://okime.com/v1/api/santral/sorgu/sq_8f2c4d1e9a7b3c5d/yanit" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{"mesaj": "Your October invoice: 389.90 TL, due 15 November."}'

Example response 200

{
  "tamam": true
}

Possible errors

HTTPkodWhen
400mesajmesaj is empty or longer than 2000 characters.
404sorgu_yokNo such query for this business, the query was not answered with sonra, or 24 hours have passed.
409yanitlandiThis query has already been answered; no second message is sent.
429sinirThe business's daily automatic message limit is reached; the message was not sent (mesaj_gitmedi is logged).

Managing blocks with the API

You can also manage blocks from your own system instead of the dashboard. Fields are as in the block fields table.

List blocks

GET/v1/api/santral/sorgular

All blocks; webhook: whether a webhook address is set; istatistik: today's query and error count per block.

Example response 200

{
  "sorgular": [
    {
      "kod": "bakiye",
      "ad": "Balance",
      "aciklama": "Wallet balance, with PIN",
      "kimlik": "oki",
      "girdi": "rakam",
      "girdiMetni": "Please enter your four-digit PIN, then press hash.",
      "girdiUzunluk": 4,
      "anons": "Your balance has been sent to you as a message.",
      "aktif": true
    },
    {
      "kod": "kampanya",
      "ad": "Campaigns",
      "aciklama": "",
      "kimlik": "oki",
      "girdi": "yok",
      "girdiMetni": "",
      "girdiUzunluk": 0,
      "anons": "",
      "aktif": true
    }
  ],
  "webhook": true,
  "istatistik": {
    "bakiye":   {"bugun": 42, "hata": 1},
    "kampanya": {"bugun": 7,  "hata": 0}
  }
}

Add a block

POST/v1/api/santral/sorgular

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

HTTPkodWhen
400sorguA field rule (code format, lengths, missing girdiMetni / girdiUzunluk with girdi: "rakam"); hata says which.
400sinirThe business already has 50 blocks.
409kod_varA block with this code already exists.

Update a block

PUT/v1/api/santral/sorgular/{kod}

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": {…}}.

Example request

curl -X PUT "https://okime.com/v1/api/santral/sorgular/cekim" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{"ad": "Withdrawal status", "kimlik": "bagli", "girdi": "yok", "aktif": false}'

Possible errors

HTTPkodWhen
400sorguA field rule.
404—No block with this code.
409kullaniliyorTried to change the code of a block used in the menu.
409kod_varAnother block already has the new code.

Delete a block

DELETE/v1/api/santral/sorgular/{kod}

Deletes the block; the response is {"tamam": true}. If a key in the switchboard menu uses it, change that option first.

Example request

curl -X DELETE "https://okime.com/v1/api/santral/sorgular/cekim" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI"

Possible errors

HTTPkodWhen
404—No block with this code.
409kullaniliyorThe block is used in the switchboard menu.

Test a block

POST/v1/api/santral/sorgular/{kod}/dene

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.

Example request

curl -X POST "https://okime.com/v1/api/santral/sorgular/bakiye/dene" \
  -H "Authorization: Bearer $OKI_API_ANAHTARI" \
  -H "Content-Type: application/json" \
  -d '{"numara": "9012345678", "girdi": "1234"}'

Example response 200

{
  "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):

{
  "durum": "hata",
  "mesaj": "",
  "anons": "",
  "sureMs": 5000,
  "http": 0,
  "hata": "5s içinde yanıt gelmedi",
  "kod": "zaman_asimi"
}

Possible errors

HTTPkodWhen
404—No block with this code.

Full example: balance + PIN

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');
}

Error log

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 codeMeaningWhat to do
zaman_asimiYour 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.
baglantiCould not connect to your address (DNS, certificate, server down).Check the address is reachable from outside and has a valid TLS certificate.
gecersiz_yanitThe 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_durumdurum is not one of the known values.Return only tamam, sonra, dogrulanamadi, bulunamadi, hata.
webhook_yokNo webhook address is set.Set the address.
isletme_hatasiYou returned durum: "hata".Search your own log for the sorguId.
mesaj_uzun / anons_uzunText exceeded the limit; it was cut before sending / reading.mesaj ≤ 2000, anons ≤ 300.
mesaj_gitmediYour answer was received but the message could not be sent to the chat (e.g. daily automatic message limit).Tell us if it persists.
seslendirmeanons could not be voiced at that moment; the standard sentence was read instead.Usually nothing; tell us if it persists.

Older app versions

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.

Catalog & orders

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).

EndpointDescription
GET /katalogSettings (acik, siparisAcik, not) and products (id, ad, aciklama, kategori, fiyatKurus, stokta, aktif).
GET /siparisler?acik=1&bas=&bit=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).

Bots and mini apps

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 adres button 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.

EndpointDescription
GET /mini-uygulamaad, adres, menu ([{ad, veri, aciklama?, form?}]), sirVar.
PUT /mini-uygulama{"ad", "adres", "menu"}. adres https:// (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/sirRenews 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.

// Node.js
const [payload, sig] = req.query.okiGiris.split(".");
const expected = crypto.createHmac("sha256", process.env.OKI_MINI_SECRET).update(payload).digest("hex");
if (!crypto.timingSafeEqual(Buffer.from(sig, "hex"), Buffer.from(expected, "hex"))) return res.sendStatus(401);
const g = JSON.parse(Buffer.from(payload, "base64url"));
if (Date.now() / 1000 - g.zaman > 600) return res.sendStatus(401);

12.Errors and logs

HTTP status codes

HTTPMeaningWhat to do
200OK.—
202Accepted; the result will arrive via webhook (linking).Wait for the webhook.
400Bad request (missing / invalid field).Check kod and fix the request; do not retry as is.
401API key missing or invalid.Check your key.
403The business is suspended; or iliski_yok: an announcement to a customer you have never exchanged messages with.Suspended: contact Oki. iliski_yok: do not retry; send it once the customer writes, or use islem.
404Record not found.Check the ID.
409Business rule: could not be sent, cannot be changed, no longer pending.Act on kod / neden (e.g. fall back to SMS).
5xxTemporary problem.Retry a little later with the same istemciKimligi.

Error codes (kod)

kodHTTPMeaning
istek400 / 404Body is not JSON (or is too large); for linking status: request not found.
istemci_kimligi400istemciKimligi missing or not 8–64 characters (letters, digits, _ -).
alici400None of disKimlik, telefon or konusma was given.
dis_kimlik400Invalid disKimlik format.
telefon400Phone number is not in international format with a country code.
tur400Invalid message or media type.
metin400Text missing, empty or too long.
medya400medya.nesne / medya.tur invalid.
dugmeler400Button rule (count, label, type or the type's field).
mesajlar400Batch message count outside 1–100.
ayrinti, sure400Approval request fields.
kod, uzunluk, uygulama400Verification code fields.
musteriler, musteri, alan400 / 404Customer and field endpoints.
boyut400Media size missing or over the limit.
oncesi, durum400Conversation endpoints.
mesaj, konusma, onay, dogrulama, webhook400 / 404Invalid ID or record not found.
atanan404 / 409No active member with this number / cannot be assigned to this person.
ulasilamadi409Message could not be sent; see neden below.
oki_gerek409An approval card can only be sent to a customer on the Oki app.
degismez409Recalled, approval or verification messages cannot be edited.
onay_bitti409The approval request is no longer pending (durum in the body).
sorgu, sorgu_yok, kod_var, kullaniliyor, yanitlandi400 / 404 / 409Switchboard query endpoints (see Switchboard queries).
webhook_yok409No webhook URL is set.
telefon_kapali503Sending / linking by phone number is temporarily disabled.
ic_hata500Internal error; retry, and if it persists, report it with the Oki-Istek ID.

Not delivered: neden

nedenMeaningRecommended
bagli_degilNo customer with this disKimlik, or the card has neither an Oki account nor a phone number.Try by phone number or send an SMS.
oki_yokNo Oki user with this phone number.Send an SMS.
engelliThe customer blocked the business.Do not send; use SMS if needed.
kaldirdiThe customer removed the link (no longer wants to receive messages).Do not send; use SMS if needed.
duyuru_kapaliThe customer turned off announcements (duyuru only).Do not send. Transactional notifications still go through.
sinirSending limit exceeded.Try later; use SMS for urgent transactions.
saatAnnouncements only 08:00–21:00 (Turkey time).Send within those hours.

Oki-Istek and the API log

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.

13.Privacy and rules

  • 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.

14.Changelog

VersionDateChanges
Docs15 November 2026Descriptions 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.
Docs12 November 2026Announcements 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.
Docs8 November 2026Switchboard 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.
Docs8 November 2026List 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.
Docs31 October 2026Bots 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.
v229 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.
v125 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.