{
  "openapi": "3.0.3",
  "info": {
    "title": "ZYREX SHOP Reseller API",
    "version": "1.0.0",
    "description": "OTP nomor SERVER 1–5 dan SMM. Semua harga rupiah. Isi server URL milik toko. Key hanya digunakan di backend. Tidak ada webhook reseller, OTP email, refill SMM, atau endpoint minta OTP ulang pada kontrak publik ini."
  },
  "servers": [
    {
      "url": "/api/v1",
      "description": "Ganti dengan https://DOMAIN-TOKO/api/v1 bila tool membutuhkan URL absolut."
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/balance": {
      "get": {
        "summary": "Cek saldo",
        "operationId": "get_balance",
        "tags": [
          "OTP"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/services": {
      "get": {
        "summary": "Daftar layanan",
        "operationId": "get_services",
        "tags": [
          "OTP"
        ],
        "parameters": [
          {
            "name": "server",
            "in": "query",
            "required": false,
            "description": "Pilihan 1–5; tanpa server memberi ringkasan semua server.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country_id",
            "in": "query",
            "required": false,
            "description": "Opsional untuk harga/stok layanan SERVER 2, 4, 5.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/countries": {
      "get": {
        "summary": "Daftar negara",
        "operationId": "get_countries",
        "tags": [
          "OTP"
        ],
        "parameters": [
          {
            "name": "server",
            "in": "query",
            "required": false,
            "description": "Pilihan 1–5; default 1.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service_id",
            "in": "query",
            "required": false,
            "description": "Wajib khusus SERVER 1; dari katalog layanan.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "SERVER 1: provider_1 (default), provider_2 atau provider_3.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/offers": {
      "get": {
        "summary": "Harga dan pilihan nomor",
        "operationId": "get_offers",
        "tags": [
          "OTP"
        ],
        "parameters": [
          {
            "name": "server",
            "in": "query",
            "required": false,
            "description": "Pilihan 1–5; default 1.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service_id",
            "in": "query",
            "required": true,
            "description": "ID layanan dari server yang dipilih.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country_id",
            "in": "query",
            "required": false,
            "description": "Wajib salah satu country_id/country_code. SERVER 2–5 memakai country_id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country_code",
            "in": "query",
            "required": false,
            "description": "Wajib bila country_id tidak dikirim. SERVER 1 memakai country_code dari katalog.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "SERVER 1: pilihan abstrak provider_1/2/3.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/order": {
      "post": {
        "summary": "Beli OTP",
        "operationId": "post_order",
        "tags": [
          "OTP"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Wajib 16–128 karakter; alternatif field idempotency_key di JSON. Simpan dan pakai ulang untuk retry order yang sama.",
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "201": {
            "description": "Order baru diterima",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "202": {
            "description": "Masih diperiksa; jangan ulang pembelian dengan key berbeda",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OTPOrder"
              }
            }
          }
        }
      }
    },
    "/order/{order_id}": {
      "get": {
        "summary": "Status dan kode OTP",
        "operationId": "get_order_order_id",
        "tags": [
          "OTP"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID order milik akun pemilik key."
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/order/{order_id}/cancel": {
      "post": {
        "summary": "Batalkan OTP",
        "operationId": "post_order_order_id_cancel",
        "tags": [
          "OTP"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID order milik akun pemilik key."
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "202": {
            "description": "Masih diperiksa; jangan ulang pembelian dengan key berbeda",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/smm/services": {
      "get": {
        "summary": "Katalog SMM",
        "operationId": "get_smm_services",
        "tags": [
          "SMM"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    },
    "/smm/order": {
      "post": {
        "summary": "Beli SMM",
        "operationId": "post_smm_order",
        "tags": [
          "SMM"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Wajib 16–128 karakter; alternatif field idempotency_key di JSON. Simpan dan pakai ulang untuk retry order yang sama.",
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "201": {
            "description": "Order baru diterima",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "202": {
            "description": "Masih diperiksa; jangan ulang pembelian dengan key berbeda",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SMMOrder"
              }
            }
          }
        }
      }
    },
    "/smm/order/{order_id}": {
      "get": {
        "summary": "Status SMM",
        "operationId": "get_smm_order_order_id",
        "tags": [
          "SMM"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID order milik akun pemilik key."
          }
        ],
        "responses": {
          "200": {
            "description": "Hasil baca atau order tersimpan yang diulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "400": {
            "description": "Parameter tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "401": {
            "description": "Key wajib atau tidak valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "402": {
            "description": "Saldo tidak cukup",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "403": {
            "description": "Akses ditolak",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "404": {
            "description": "Data bukan milik akun atau tidak ditemukan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "409": {
            "description": "Konflik, penolakan atau batas pembatalan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit; tunggu sesuai message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "500": {
            "description": "Pencatatan lokal gagal; hasil POST bisa belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "502": {
            "description": "ID belum dikonfirmasi; jangan membeli ulang",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "503": {
            "description": "Server belum tersedia atau hasil belum pasti",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "OTPOrder": {
        "type": "object",
        "required": [
          "server",
          "service_id"
        ],
        "properties": {
          "service_id": {
            "type": "string"
          },
          "country_id": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "number_id": {
            "type": "string"
          },
          "product_id": {
            "type": "string"
          },
          "quote_id": {
            "type": "string"
          },
          "service_name": {
            "type": "string"
          },
          "country_name": {
            "type": "string"
          },
          "country_prefix": {
            "type": "string"
          },
          "service_img": {
            "type": "string"
          },
          "operator_id": {
            "type": "string"
          },
          "idempotency_key": {
            "type": "string"
          },
          "server": {
            "oneOf": [
              {
                "type": "integer",
                "enum": [
                  1,
                  2,
                  3,
                  4,
                  5
                ]
              },
              {
                "type": "string",
                "enum": [
                  "1",
                  "2",
                  "3",
                  "4",
                  "5"
                ]
              }
            ]
          },
          "quoted_price": {
            "type": "number",
            "description": "Salin nilai dari offer SERVER 1/3; berbeda dari price jual."
          }
        },
        "description": "SERVER 1: country_code/provider/number_id; SERVER 3: country_id/product_id; SERVER 2/4/5: country_id/quote_id. Idempotency-Key wajib melalui header atau idempotency_key body. Quote berlaku 90 detik."
      },
      "SMMOrder": {
        "type": "object",
        "required": [
          "service_id",
          "target"
        ],
        "properties": {
          "service_id": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Wajib untuk layanan biasa; komentar custom mengikuti jumlah baris."
          },
          "comments": {
            "type": "string",
            "description": "Satu komentar per baris bila requires_comments=true."
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 16,
            "maxLength": 128
          }
        }
      },
      "Response": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        },
        "additionalProperties": true
      }
    }
  }
}
