{
  "openapi": "3.0.0",
  "info": {
    "title": "Jetpac Partner API",
    "description": "## Overview\nComplete API testing suite for eSIM and travel package services with automatic authentication. This collection provides comprehensive access to JETPAC's B2B platform for managing travel eSIMs, packages, and orders.\n\n## Authentication\n- **Method**: Basic Authentication (API Key + Secret) for token generation.\n- **Token Type**: JWT (JSON Web Token) for all other endpoints.\n- **Token Expiry**: 1 hour (3600 seconds).",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://nlb-us-west-2.jetpacglobal.com",
      "description": "Production Server"
    },
    {
      "url": "https://nlb-ap-southeast-1.jetpacstaging.com",
      "description": "Staging Server"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Obtain an authentication token to access other API endpoints."
    },
    {
      "name": "Package Details",
      "description": "Manage and retrieve information about travel packages and destinations."
    },
    {
      "name": "Orders",
      "description": "Manage the complete order lifecycle for eSIM package purchases."
    },
    {
      "name": "eSIM",
      "description": "Manage eSIM profiles and access installation support."
    },
    {
      "name": "Compatible Devices",
      "description": "Retrieve information about eSIM-compatible devices."
    }
  ],
  "paths": {
    "/v1/b2b/{tenant_id}/token": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Get Authentication Token",
        "description": "Authenticates with the API using Basic Auth (API Key + Secret) and returns a JWT token.",
        "operationId": "getAuthToken",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          }
        ],
        "security": [
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Token generated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthSuccessResponse"
                },
                "example": {
                  "status": "success",
                  "status_code": 200,
                  "message": "Token generated successfully",
                  "data": {
                    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
                    "token_expiry": 3600
                  },
                  "error": "",
                  "timestamp": "2025-01-15T18:28:14.105Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequestsError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/destinations": {
      "get": {
        "tags": [
          "Package Details"
        ],
        "summary": "Get All Destinations",
        "description": "Retrieves a list of all available travel destinations.",
        "operationId": "getAllDestinations",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved all destinations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DestinationsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "404": {
            "description": "No destinations available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/packages/{destination_key}": {
      "get": {
        "tags": [
          "Package Details"
        ],
        "summary": "Get Available Packages by Destination",
        "description": "Retrieves available packages for a specific destination key.",
        "operationId": "getPackagesByDestination",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          },
          {
            "name": "destination_key",
            "in": "path",
            "required": true,
            "description": "The unique key for the destination (e.g., \"europe-esim\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved package details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PackagesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "404": {
            "description": "Destination not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/order": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Submit Order",
        "description": "Creates a new order for one or more eSIM packages.",
        "operationId": "submitOrder",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "An array of order items.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderItemRequest"
                }
              },
              "example": [
                {
                  "catalog_id": "963264033499086850",
                  "customer_email": "customer1@example.com",
                  "firstname": "John",
                  "lastname": "Doe"
                }
              ]
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK - Order placed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitOrderResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "409": {
            "description": "Order already exists for this customer and catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/order/all": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get All Orders",
        "description": "Retrieves a paginated list of all orders for the tenant.",
        "operationId": "getAllOrders",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedOrdersResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "404": {
            "description": "No orders found for this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/order/{order_id}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get Specific Order",
        "description": "Retrieves detailed information for a specific order by its ID.",
        "operationId": "getSpecificOrder",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          },
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "description": "The unique identifier of the order.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved order details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDetailsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "404": {
            "description": "Order not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/esim/all": {
      "get": {
        "tags": [
          "eSIM"
        ],
        "summary": "Get All eSIMs",
        "description": "Retrieves a paginated list of all eSIMs for the tenant.",
        "operationId": "getAllEsims",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved eSIMs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEsimsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "404": {
            "description": "No eSIMs found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/esim/{iccid}": {
      "get": {
        "tags": [
          "eSIM"
        ],
        "summary": "Get Specific eSIM",
        "description": "Retrieves detailed information for a specific eSIM by its ICCID.",
        "operationId": "getSpecificEsim",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          },
          {
            "name": "iccid",
            "in": "path",
            "required": true,
            "description": "The Integrated Circuit Card Identifier of the eSIM.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved eSIM details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EsimDetailsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "404": {
            "description": "eSIM not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/esim/installation-guide": {
      "get": {
        "tags": [
          "eSIM"
        ],
        "summary": "Get Installation Guide",
        "description": "Retrieves a link to the eSIM installation guide document.",
        "operationId": "getInstallationGuide",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved the installation guide link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallationGuideResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "404": {
            "description": "Installation guide not available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/b2b/{tenant_id}/compatible-devices/all": {
      "get": {
        "tags": [
          "Compatible Devices"
        ],
        "summary": "Get All Compatible Devices",
        "description": "Retrieves a list of all eSIM-compatible devices, grouped by type and brand.",
        "operationId": "getCompatibleDevices",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantId"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK - Successfully retrieved the list of compatible devices.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompatibleDevicesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "404": {
            "description": "No compatible devices found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "parameters": {
      "TenantId": {
        "name": "tenant_id",
        "in": "path",
        "required": true,
        "description": "Your unique tenant identifier.",
        "schema": {
          "type": "string"
        }
      },
      "Page": {
        "name": "page",
        "in": "query",
        "description": "Page number for pagination.",
        "schema": {
          "type": "integer",
          "default": 1
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Number of items per page.",
        "schema": {
          "type": "integer",
          "default": 10
        }
      }
    },
    "responses": {
      "UnauthorizedError": {
        "description": "Unauthorized - Invalid or expired credentials/token.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ForbiddenError": {
        "description": "Forbidden - Access is denied.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadRequestError": {
        "description": "Bad Request - Invalid syntax or missing parameters.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequestsError": {
        "description": "Too Many Requests - Rate limit exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal Server Error - An unexpected error occurred.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "ApiResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "success"
          },
          "status_code": {
            "type": "integer",
            "example": 200
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "example": "error"
          },
          "code": {
            "type": "integer"
          }
        }
      },
      "AuthSuccessResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "token_expiry": {
                    "type": "integer",
                    "description": "Token validity in seconds.",
                    "example": 3600
                  }
                }
              }
            }
          }
        ]
      },
      "Destination": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Unique identifier for the destination.",
            "example": "europe-esim"
          },
          "destination": {
            "type": "string",
            "description": "Human-readable name of the destination.",
            "example": "Europe"
          }
        }
      },
      "DestinationsResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Destination"
                }
              }
            }
          }
        ]
      },
      "Package": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "image": {
            "type": "string",
            "format": "uri"
          },
          "data_in_gb": {
            "type": "number",
            "format": "float"
          },
          "validity_in_days": {
            "type": "integer"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "supports_5g": {
            "type": "boolean"
          },
          "price": {
            "type": "number",
            "format": "float"
          },
          "callout": {
            "type": "string"
          },
          "base_price": {
            "type": "number",
            "format": "float"
          },
          "benefits": {
            "type": "string"
          },
          "usage_policy": {
            "type": "string"
          }
        }
      },
      "PackagesResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Package"
                }
              }
            }
          }
        ]
      },
      "OrderItemRequest": {
        "type": "object",
        "required": [
          "catalog_id",
          "customer_email",
          "firstname",
          "lastname"
        ],
        "properties": {
          "catalog_id": {
            "type": "string",
            "description": "Unique identifier for the eSIM package."
          },
          "customer_email": {
            "type": "string",
            "format": "email"
          },
          "firstname": {
            "type": "string"
          },
          "lastname": {
            "type": "string"
          }
        }
      },
      "SubmitOrderResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "order_id": {
            "type": "string",
            "format": "uuid"
          },
          "catalog_id": {
            "type": "integer",
            "format": "int64"
          },
          "catalog_name": {
            "type": "string"
          },
          "validity_in_days": {
            "type": "string"
          },
          "data_in_gb": {
            "type": "string"
          },
          "created_on": {
            "type": "string",
            "format": "date-time"
          },
          "updated_on": {
            "type": "string",
            "format": "date-time"
          },
          "created_by": {
            "type": "string"
          },
          "updated_by": {
            "type": "string"
          }
        }
      },
      "PaginatedOrdersResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "orders": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Order"
                    }
                  },
                  "limit": {
                    "type": "integer"
                  },
                  "page": {
                    "type": "integer"
                  },
                  "total": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        ]
      },
      "OrderDetailsResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          }
        ]
      },
      "Esim": {
        "type": "object",
        "properties": {
          "iccid": {
            "type": "string"
          },
          "esim_status": {
            "type": "string",
            "enum": [
              "PROVISIONED",
              "TERMINATED",
              "INACTIVE"
            ]
          },
          "tenant_id": {
            "type": "string"
          },
          "order_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_email": {
            "type": "string",
            "format": "email"
          },
          "created_on": {
            "type": "string",
            "format": "date-time"
          },
          "created_by": {
            "type": "string"
          },
          "updated_on": {
            "type": "string",
            "format": "date-time"
          },
          "updated_by": {
            "type": "string"
          }
        }
      },
      "PaginatedEsimsResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "esims": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Esim"
                    }
                  },
                  "limit": {
                    "type": "integer"
                  },
                  "page": {
                    "type": "integer"
                  },
                  "total": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        ]
      },
      "EsimPlan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "user_email": {
            "type": "string",
            "format": "email"
          },
          "catalog_id": {
            "type": "integer",
            "format": "int64"
          },
          "catalog_name": {
            "type": "string"
          },
          "validity_in_days": {
            "type": "string"
          },
          "data_in_gb": {
            "type": "string"
          },
          "applied_plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "INACTIVE"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EsimDetailsResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "iccid": {
                    "type": "string"
                  },
                  "esim_status": {
                    "type": "string"
                  },
                  "plans": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/EsimPlan"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "InstallationGuideResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "string",
                "format": "uri",
                "description": "A URL pointing to the installation guide document.",
                "example": "https://jetpac-b2b.s3.amazonaws.com/eSIM%20Installation%20Instructions%20sample.pdf"
              }
            }
          }
        ]
      },
      "DeviceModel": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "os": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "DeviceBrand": {
        "type": "object",
        "properties": {
          "brand": {
            "type": "string"
          },
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeviceModel"
            }
          }
        }
      },
      "DeviceType": {
        "type": "object",
        "properties": {
          "device_type": {
            "type": "string",
            "example": "Mobile"
          },
          "devices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeviceBrand"
            }
          }
        }
      },
      "CompatibleDevicesResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeviceType"
                }
              }
            }
          }
        ]
      }
    }
  }
}
