Tokolaku Sub-accounts & Keys API

Sub-akun (bisnis klien) & API key — sesi login.

GitHub OpenAPI

Operations 4

POST /api/dev/sub-accounts Buat sub-akun (bisnis klien) baru #
GET /api/dev/sub-accounts Daftar sub-akun milik org #
POST /api/dev/sub-accounts/{tenantId}/keys Terbitkan API key untuk sub-akun #
POST /api/dev/keys/{keyId}/revoke Cabut sebuah API key #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/tokolaku-id:tokolaku-id-sub-accounts-keys-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

tokolaku-id-sub-accounts-keys-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Tokolaku Engine Sub-accounts & Keys API
  version: 1.0.0
  description: 'REST API untuk integrasi bot AI, pengiriman pesan (WhatsApp/Instagram/Messenger via BYON), webhook real-time, dan manajemen sub-akun/reseller di Tokolaku.


    **Autentikasi**

    - Endpoint publik `/api/v1/*` (Messaging): header `Authorization: Bearer ` (format `tk_live_sk_...` / `tk_test_sk_...`). Setiap key punya scope (`chat:write`, `messages:write`, dst).

    - Endpoint dashboard `/api/dev/*`: sesi login (cookie) developer — dipanggil dari aplikasi/dashboard kamu sendiri, bukan server-to-server publik.


    **Webhook (kami → aplikasi kamu)**

    Event `message.received` dan `message.status` dikirim sebagai `POST` ke URL webhook yang kamu daftarkan, dengan header:

    - `X-Tokolaku-Event`: nama event (mis. `message.received`)

    - `X-Tokolaku-Signature`: `sha256=`

    - `X-Tokolaku-Delivery`: id pengiriman (dipakai juga untuk dedup saat retry)


    Body mengikuti skema `WebhookEvent`. Balas `2xx` untuk menandai sukses; kegagalan di-retry dengan backoff eksponensial (60s → 1920s, hingga 6x).'
  contact:
    name: Tokolaku
    url: https://tokolaku.id
servers:
- url: https://api.tokolaku.id
  description: Production
security:
- bearerAuth: []
tags:
- name: Sub-accounts & Keys
  description: Sub-akun (bisnis klien) & API key — sesi login.
paths:
  /api/dev/sub-accounts:
    post:
      tags:
      - Sub-accounts & Keys
      summary: Buat sub-akun (bisnis klien) baru
      security:
      - sessionAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubAccountCreateRequest'
            example:
              name: Toko Berkah Jaya
      responses:
        '200':
          description: Sub-akun berhasil dibuat
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubAccountCreateResponse'
              example:
                org_id: org_...
                tenant_id: ten_...
        '403':
          description: Batas sub-akun paket ini tercapai
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                error:
                  code: sub_account_limit
                  message: Batas sub-akun paket ini tercapai. Upgrade ke Pro.
      operationId: postApiDevSubAccounts
      x-operation-id-source: derived
    get:
      tags:
      - Sub-accounts & Keys
      summary: Daftar sub-akun milik org
      security:
      - sessionAuth: []
      responses:
        '200':
          description: Daftar sub-akun
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/SubAccount'
              example:
                data:
                - id: ten_...
                  business_name: Toko Berkah Jaya
                  created_at: '2026-09-04T10:00:00.000Z'
      operationId: getApiDevSubAccounts
      x-operation-id-source: derived
  /api/dev/sub-accounts/{tenantId}/keys:
    post:
      tags:
      - Sub-accounts & Keys
      summary: Terbitkan API key untuk sub-akun
      description: Plaintext key hanya muncul sekali di response ini.
      security:
      - sessionAuth: []
      parameters:
      - name: tenantId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateRequest'
            example:
              type: secret
              environment: live
              scopes:
              - chat:write
              allowed_origins: []
      responses:
        '200':
          description: Key berhasil dibuat
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreateResponse'
              example:
                id: key_...
                key: tk_live_sk_xxx
                prefix: tk_live_sk_
                last4: a1b2
        '400':
          description: Scope tidak valid untuk publishable key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                error:
                  code: invalid_scope
                  message: Publishable key hanya boleh scope chat:*
        '403':
          description: Live key butuh paket Pro
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                error:
                  code: live_requires_pro
                  message: Live key butuh paket Pro. Upgrade dulu.
        '404':
          description: Sub-akun tidak ditemukan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                error:
                  code: not_found
                  message: Sub-akun tidak ditemukan
      operationId: postApiDevSubAccountsByTenantIdKeys
      x-operation-id-source: derived
  /api/dev/keys/{keyId}/revoke:
    post:
      tags:
      - Sub-accounts & Keys
      summary: Cabut sebuah API key
      security:
      - sessionAuth: []
      parameters:
      - name: keyId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Key berhasil dicabut
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
              example:
                ok: true
        '404':
          description: Key tidak ditemukan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                error:
                  code: not_found
                  message: Key tidak ditemukan
      operationId: postApiDevKeysByKeyIdRevoke
      x-operation-id-source: derived
components:
  schemas:
    ErrorEnvelope:
      type: object
      description: Envelope error konsisten untuk semua endpoint Engine API.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
          - code
          - message
      required:
      - error
    SubAccountCreateRequest:
      type: object
      properties:
        name:
          type: string
      required:
      - name
    ApiKeyCreateResponse:
      type: object
      properties:
        id:
          type: string
        key:
          type: string
          description: Plaintext — HANYA muncul di response ini
        prefix:
          type: string
        last4:
          type: string
      required:
      - id
      - key
      - prefix
      - last4
    SubAccount:
      type: object
      properties:
        id:
          type: string
        business_name:
          type:
          - string
          - 'null'
        created_at:
          type: string
          format: date-time
      required:
      - id
      - business_name
    ApiKeyCreateRequest:
      type: object
      properties:
        type:
          type: string
          enum:
          - secret
          - publishable
        environment:
          type: string
          enum:
          - live
          - test
          default: live
        scopes:
          type: array
          items:
            type: string
        allowed_origins:
          type: array
          items:
            type: string
      required:
      - type
    SubAccountCreateResponse:
      type: object
      properties:
        org_id:
          type: string
        tenant_id:
          type: string
      required:
      - org_id
      - tenant_id
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Secret key developer, format `tk_live_sk_...` (produksi) atau `tk_test_sk_...` (sandbox). Kirim via header `Authorization: Bearer <key>` (atau `X-API-Key: <key>`).'
    sessionAuth:
      type: apiKey
      in: cookie
      name: session
      description: Endpoint dashboard `/api/dev/*` diautentikasi via sesi login developer (cookie), bukan API key — dipanggil dari aplikasi/dashboard kamu sendiri saat sudah login.