{
  "openapi": "3.1.0",
  "info": {
    "title": "Telyne API",
    "version": "2026-09-01",
    "description": "One API across every capability. REST over HTTPS, JSON in and out, no envelope. A test key reaches simulated resources and cannot reach live ones; the platform enforces that boundary rather than trusting you to."
  },
  "servers": [
    {
      "url": "https://api.telyne.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key. sk_test_ reaches simulated resources; sk_live_ reaches live ones."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message",
              "link"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "authentication",
                  "permission",
                  "not_found",
                  "conflict",
                  "rate_limit",
                  "capability",
                  "supplier",
                  "internal"
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "missing_parameter",
                  "invalid_parameter",
                  "unsupported_version",
                  "idempotency_key_required",
                  "body_not_json",
                  "key_missing",
                  "key_invalid",
                  "key_revoked",
                  "key_out_of_scope",
                  "test_key_live_resource",
                  "live_key_test_resource",
                  "verification_required",
                  "balance_insufficient",
                  "resource_not_found",
                  "no_such_route",
                  "idempotency_key_reused",
                  "already_exists",
                  "invalid_state_transition",
                  "rate_limited",
                  "capability_not_live",
                  "capability_not_orderable",
                  "pricing_unavailable",
                  "supplier_unavailable",
                  "supplier_refused",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string",
                "description": "For a person. May be improved between versions; branch on code."
              },
              "param": {
                "type": "string",
                "description": "The parameter at fault, present only when the error is about one."
              },
              "link": {
                "type": "string",
                "format": "uri"
              },
              "detail": {
                "type": "string"
              }
            }
          }
        }
      },
      "Esim": {
        "type": "object",
        "required": [
          "object",
          "id",
          "iccid",
          "state",
          "created_at"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "esim"
            ]
          },
          "id": {
            "type": "string"
          },
          "iccid": {
            "type": "string",
            "pattern": "^[0-9]{19}$"
          },
          "state": {
            "type": "string",
            "enum": [
              "released",
              "installed",
              "active",
              "suspended",
              "expired"
            ]
          },
          "bundle": {
            "type": [
              "string",
              "null"
            ]
          },
          "data_used_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "data_limit_bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "activation_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The LPA string, as encoded by the install QR code: LPA:1$<smdp_address>$<matching_id>. On a sandbox profile the host is sandbox.telyne.com and the matching id begins TEST-, so it cannot install on a handset."
          },
          "smdp_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "matching_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "description": "When the bundle runs out, derived from its duration. Null when the bundle is not one with a stated duration."
          },
          "created_at": {
            "type": "integer"
          },
          "updated_at": {
            "type": "integer"
          },
          "simulated": {
            "type": "boolean",
            "description": "true for a sandbox resource. A live resource reports false."
          }
        }
      },
      "Bundle": {
        "type": "object",
        "required": [
          "object",
          "name",
          "price_cents",
          "currency"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "bundle"
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "data_mb": {
            "type": [
              "integer",
              "null"
            ]
          },
          "unlimited": {
            "type": "boolean"
          },
          "duration_days": {
            "type": "integer"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            }
          },
          "price_cents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "simulated": {
            "type": "boolean"
          },
          "rated": {
            "type": "boolean",
            "description": "false in the sandbox: nothing there is rated or invoiced."
          }
        },
        "example": {
          "object": "bundle",
          "name": "esim_1GB_7D_GB_V2",
          "description": "1 GB, 7 days, United Kingdom",
          "data_mb": 1024,
          "duration_days": 7,
          "countries": [
            "GB"
          ],
          "price_cents": 184,
          "unlimited": false,
          "currency": "USD",
          "simulated": true,
          "rated": false
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "object",
          "id",
          "type",
          "time",
          "data"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "esim.released",
              "esim.installed",
              "esim.activated",
              "esim.suspended",
              "esim.expired",
              "esim.usage.threshold",
              "api_key.issued",
              "api_key.first_used",
              "api_key.revoked"
            ]
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "integer"
          },
          "data": {
            "type": "object"
          },
          "environment": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "x-telyne": {
    "rate_limit_per_minute": 120,
    "error_codes": [
      {
        "code": "missing_parameter",
        "type": "invalid_request",
        "status": 400,
        "link": "https://api.telyne.com/v1/errors/missing_parameter"
      },
      {
        "code": "invalid_parameter",
        "type": "invalid_request",
        "status": 400,
        "link": "https://api.telyne.com/v1/errors/invalid_parameter"
      },
      {
        "code": "unsupported_version",
        "type": "invalid_request",
        "status": 400,
        "link": "https://api.telyne.com/v1/errors/unsupported_version"
      },
      {
        "code": "idempotency_key_required",
        "type": "invalid_request",
        "status": 400,
        "link": "https://api.telyne.com/v1/errors/idempotency_key_required"
      },
      {
        "code": "body_not_json",
        "type": "invalid_request",
        "status": 400,
        "link": "https://api.telyne.com/v1/errors/body_not_json"
      },
      {
        "code": "key_missing",
        "type": "authentication",
        "status": 401,
        "link": "https://api.telyne.com/v1/errors/key_missing"
      },
      {
        "code": "key_invalid",
        "type": "authentication",
        "status": 401,
        "link": "https://api.telyne.com/v1/errors/key_invalid"
      },
      {
        "code": "key_revoked",
        "type": "authentication",
        "status": 401,
        "link": "https://api.telyne.com/v1/errors/key_revoked"
      },
      {
        "code": "key_out_of_scope",
        "type": "permission",
        "status": 403,
        "link": "https://api.telyne.com/v1/errors/key_out_of_scope"
      },
      {
        "code": "test_key_live_resource",
        "type": "permission",
        "status": 403,
        "link": "https://api.telyne.com/v1/errors/test_key_live_resource"
      },
      {
        "code": "live_key_test_resource",
        "type": "permission",
        "status": 403,
        "link": "https://api.telyne.com/v1/errors/live_key_test_resource"
      },
      {
        "code": "verification_required",
        "type": "permission",
        "status": 403,
        "link": "https://api.telyne.com/v1/errors/verification_required"
      },
      {
        "code": "balance_insufficient",
        "type": "permission",
        "status": 402,
        "link": "https://api.telyne.com/v1/errors/balance_insufficient"
      },
      {
        "code": "resource_not_found",
        "type": "not_found",
        "status": 404,
        "link": "https://api.telyne.com/v1/errors/resource_not_found"
      },
      {
        "code": "no_such_route",
        "type": "not_found",
        "status": 404,
        "link": "https://api.telyne.com/v1/errors/no_such_route"
      },
      {
        "code": "idempotency_key_reused",
        "type": "conflict",
        "status": 409,
        "link": "https://api.telyne.com/v1/errors/idempotency_key_reused"
      },
      {
        "code": "already_exists",
        "type": "conflict",
        "status": 409,
        "link": "https://api.telyne.com/v1/errors/already_exists"
      },
      {
        "code": "invalid_state_transition",
        "type": "conflict",
        "status": 409,
        "link": "https://api.telyne.com/v1/errors/invalid_state_transition"
      },
      {
        "code": "rate_limited",
        "type": "rate_limit",
        "status": 429,
        "link": "https://api.telyne.com/v1/errors/rate_limited"
      },
      {
        "code": "capability_not_live",
        "type": "capability",
        "status": 409,
        "link": "https://api.telyne.com/v1/errors/capability_not_live"
      },
      {
        "code": "capability_not_orderable",
        "type": "capability",
        "status": 409,
        "link": "https://api.telyne.com/v1/errors/capability_not_orderable"
      },
      {
        "code": "pricing_unavailable",
        "type": "capability",
        "status": 503,
        "link": "https://api.telyne.com/v1/errors/pricing_unavailable"
      },
      {
        "code": "supplier_unavailable",
        "type": "supplier",
        "status": 503,
        "link": "https://api.telyne.com/v1/errors/supplier_unavailable"
      },
      {
        "code": "supplier_refused",
        "type": "supplier",
        "status": 503,
        "link": "https://api.telyne.com/v1/errors/supplier_refused"
      },
      {
        "code": "internal_error",
        "type": "internal",
        "status": 500,
        "link": "https://api.telyne.com/v1/errors/internal_error"
      }
    ],
    "event_types": [
      "esim.released",
      "esim.installed",
      "esim.activated",
      "esim.suspended",
      "esim.expired",
      "esim.usage.threshold",
      "api_key.issued",
      "api_key.first_used",
      "api_key.revoked"
    ],
    "environments": [
      "test",
      "live"
    ]
  },
  "paths": {
    "/v1/version": {
      "get": {
        "operationId": "getVersion",
        "summary": "Which version answers this account",
        "parameters": [
          {
            "name": "Telyne-Version",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "2026-09-01"
              ]
            },
            "description": "Omit to use the version pinned to this account at its first call."
          }
        ],
        "responses": {
          "200": {
            "description": "The pinned version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "serves": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event_types": {
      "get": {
        "operationId": "listEventTypes",
        "summary": "Every event type the platform emits",
        "responses": {
          "200": {
            "description": "The catalogue",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as ?cursor= to continue. Cursor rather than offset, because offset breaks under concurrent writes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/error_codes": {
      "get": {
        "operationId": "listErrorCodes",
        "summary": "Every error code and its shape",
        "responses": {
          "200": {
            "description": "The codes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as ?cursor= to continue. Cursor rather than offset, because offset breaks under concurrent writes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/esim/bundles": {
      "get": {
        "operationId": "listBundles",
        "summary": "Bundles available to buy",
        "parameters": [
          {
            "name": "countries",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}(,[A-Za-z]{2})*$"
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bundles",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Bundle"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as ?cursor= to continue. Cursor rather than offset, because offset breaks under concurrent writes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version, invalid_parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "capability_not_orderable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "pricing_unavailable, supplier_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/esim": {
      "get": {
        "operationId": "listEsims",
        "summary": "eSIMs on this account",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "eSIMs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Esim"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as ?cursor= to continue. Cursor rather than offset, because offset breaks under concurrent writes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createEsim",
        "summary": "Buy an eSIM",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "Required on every call that changes something. The result is stored against it and a repeat returns the original response."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "bundle"
                ],
                "properties": {
                  "bundle": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10,
                    "default": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The order and what it created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version, missing_parameter, invalid_parameter, idempotency_key_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "balance_insufficient",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope, verification_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "idempotency_key_reused, capability_not_orderable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "supplier_refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/esim/{id}": {
      "get": {
        "operationId": "getEsim",
        "summary": "One eSIM, by id or ICCID",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The eSIM",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Esim"
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope, test_key_live_resource, live_key_test_resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "resource_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateEsim",
        "summary": "Change an eSIM's state",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "Required on every call that changes something. The result is stored against it and a repeat returns the original response."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "state"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "released",
                      "installed",
                      "active",
                      "suspended",
                      "expired"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The eSIM after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Esim"
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version, missing_parameter, invalid_parameter, idempotency_key_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope, test_key_live_resource, live_key_test_resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "resource_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "invalid_state_transition, capability_not_orderable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "Events on this account, newest first",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as ?cursor= to continue. Cursor rather than offset, because offset breaks under concurrent writes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/replay": {
      "post": {
        "operationId": "replayEvents",
        "summary": "Deliver past events again, with the same event ids",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "Required on every call that changes something. The result is stored against it and a repeat returns the original response."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "since": {
                    "type": "integer"
                  },
                  "event": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What was queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version, idempotency_key_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "resource_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api_keys": {
      "get": {
        "operationId": "listApiKeys",
        "summary": "Keys on this account. Never their secrets.",
        "responses": {
          "200": {
            "description": "Keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as ?cursor= to continue. Cursor rather than offset, because offset breaks under concurrent writes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/test/usage": {
      "post": {
        "operationId": "driveUsage",
        "summary": "Drive usage against a simulated resource. Test keys only.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "Required on every call that changes something. The result is stored against it and a repeat returns the original response."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "esim",
                  "bytes"
                ],
                "properties": {
                  "esim": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The resource after the usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Esim"
                }
              }
            }
          },
          "400": {
            "description": "unsupported_version, missing_parameter, invalid_parameter, idempotency_key_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope, live_key_test_resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "resource_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/test/error": {
      "post": {
        "operationId": "produceError",
        "summary": "Return any documented error deliberately. Test keys only.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "Required on every call that changes something. The result is stored against it and a repeat returns the original response."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "missing_parameter",
                      "invalid_parameter",
                      "unsupported_version",
                      "idempotency_key_required",
                      "body_not_json",
                      "key_missing",
                      "key_invalid",
                      "key_revoked",
                      "key_out_of_scope",
                      "test_key_live_resource",
                      "live_key_test_resource",
                      "verification_required",
                      "balance_insufficient",
                      "resource_not_found",
                      "no_such_route",
                      "idempotency_key_reused",
                      "already_exists",
                      "invalid_state_transition",
                      "rate_limited",
                      "capability_not_live",
                      "capability_not_orderable",
                      "pricing_unavailable",
                      "supplier_unavailable",
                      "supplier_refused",
                      "internal_error"
                    ]
                  },
                  "param": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "unsupported_version, missing_parameter, invalid_parameter, idempotency_key_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "key_missing, key_invalid, key_revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "key_out_of_scope, live_key_test_resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "operationId": "getSpec",
        "summary": "This specification",
        "responses": {
          "200": {
            "description": "The specification",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}