{
  "openapi": "3.0.4",
  "info": {
    "title": "PR ScanNow Desktop Agent API",
    "description": "Loopback API exposed by PR ScanNow Desktop Agent.",
    "version": "v1"
  },
  "paths": {
    "/api/v1/agent": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/pairings": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PairingRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/pairings/{pairingId}": {
      "delete": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "pairingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/jobs": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/scan-validation": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/imports": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/outputs": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutputAssemblyRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/preview-transforms": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransformPreviewRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/blank-page-analysis": {
      "post": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlankPageAnalysisRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/sources": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/source-capabilities": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "backend",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/source-details": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "backend",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/source-status": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "backend",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/jobs/{requestId}": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/artifacts/{artifactId}": {
      "get": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ],
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/licensing/status": {
      "get": {
        "tags": [
          "Licensing"
        ],
        "summary": "Read safe local licensing status",
        "description": "Available before pairing. Never returns a license key, Lemon instance identifier, purchaser data, or raw licensing response.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicensingStatusV1"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/licensing/activate": {
      "post": {
        "tags": [
          "Licensing"
        ],
        "summary": "Activate this device",
        "description": "Accepts a user-entered key from an eligible browser origin, validates it with Lemon Squeezy, and returns safe status only. The key must not be logged or retained by browser code.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LicenseActivationRequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicensingStatusV1"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicensingStatusV1"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/licensing/verify": {
      "post": {
        "tags": [
          "Licensing"
        ],
        "summary": "Force license verification",
        "description": "Forces a Lemon Squeezy validation and resets the agent's 12-hour validation cache on success.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicensingStatusV1"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/licensing/deactivate": {
      "post": {
        "tags": [
          "Licensing"
        ],
        "summary": "Deactivate this device",
        "description": "Releases the local Lemon Squeezy activation and clears the agent's local license file. Available before pairing from an eligible origin.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicensingStatusV1"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentErrorV1"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AgentErrorCodeV1": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23
        ],
        "type": "integer",
        "format": "int32"
      },
      "AgentErrorV1": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/AgentErrorCodeV1"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "isRetryable": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "BlankPageAnalysisRequestV1": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "pageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "sourceArtifactIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "whiteThreshold": {
            "type": "number",
            "format": "double"
          },
          "blankCoverage": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "DuplexModeV1": {
        "enum": [
          0,
          1
        ],
        "type": "integer",
        "format": "int32"
      },
      "ImageTransformV1": {
        "type": "object",
        "properties": {
          "rotationDegrees": {
            "type": "integer",
            "format": "int32"
          },
          "flipHorizontal": {
            "type": "boolean"
          },
          "crop": {
            "$ref": "#/components/schemas/NormalizedCropV1"
          },
          "maximumDimensionPixels": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "deskew": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ImportRequestV1": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "profileId": {
            "type": "string",
            "nullable": true
          },
          "allowedMimeTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "maximumFiles": {
            "type": "integer",
            "format": "int32"
          },
          "maximumBytes": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "LicenseActivationRequestV1": {
        "type": "object",
        "properties": {
          "licenseKey": {
            "type": "string",
            "nullable": true
          },
          "instanceName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LicensingStatusV1": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "NormalizedCropV1": {
        "type": "object",
        "properties": {
          "left": {
            "type": "number",
            "format": "double"
          },
          "top": {
            "type": "number",
            "format": "double"
          },
          "width": {
            "type": "number",
            "format": "double"
          },
          "height": {
            "type": "number",
            "format": "double"
          },
          "isValid": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "OutputAssemblyRequestV1": {
        "type": "object",
        "properties": {
          "output": {
            "$ref": "#/components/schemas/OutputRequestV1"
          },
          "sourceArtifactIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OutputRequestV1": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "pageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "fileName": {
            "type": "string",
            "nullable": true
          },
          "quality": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PairingRequestV1": {
        "type": "object",
        "properties": {
          "origin": {
            "type": "string",
            "nullable": true
          },
          "requestedScopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionScopeV1"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaperSourceV1": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      },
      "ScanAreaMillimetersV1": {
        "type": "object",
        "properties": {
          "left": {
            "type": "number",
            "format": "double"
          },
          "top": {
            "type": "number",
            "format": "double"
          },
          "width": {
            "type": "number",
            "format": "double"
          },
          "height": {
            "type": "number",
            "format": "double"
          },
          "isPositive": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "ScanBackendV1": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      },
      "ScanColorModeV1": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      },
      "ScanRequestV1": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "profileId": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "$ref": "#/components/schemas/SourceReferenceV1"
          },
          "settings": {
            "$ref": "#/components/schemas/ScanSettingsV1"
          },
          "maximumPages": {
            "type": "integer",
            "format": "int32"
          },
          "maximumBytes": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "ScanSettingsV1": {
        "type": "object",
        "properties": {
          "resolutionDpi": {
            "type": "integer",
            "format": "int32"
          },
          "colorMode": {
            "$ref": "#/components/schemas/ScanColorModeV1"
          },
          "paperSize": {
            "type": "string",
            "nullable": true
          },
          "paperSource": {
            "$ref": "#/components/schemas/PaperSourceV1"
          },
          "autoFeed": {
            "type": "boolean"
          },
          "duplex": {
            "$ref": "#/components/schemas/DuplexModeV1"
          },
          "scanArea": {
            "$ref": "#/components/schemas/ScanAreaMillimetersV1"
          },
          "brightnessPercent": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "contrastPercent": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SessionScopeV1": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5,
          6
        ],
        "type": "integer",
        "format": "int32"
      },
      "SourceReferenceV1": {
        "type": "object",
        "properties": {
          "backend": {
            "$ref": "#/components/schemas/ScanBackendV1"
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "opaqueId": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "TransformPreviewRequestV1": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "pageId": {
            "type": "string",
            "nullable": true
          },
          "sourceArtifactId": {
            "type": "string",
            "nullable": true
          },
          "transform": {
            "$ref": "#/components/schemas/ImageTransformV1"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "tags": [
    {
      "name": "DesktopAgent.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
    },
    {
      "name": "Licensing"
    }
  ]
}