{
  "info": {
    "_postman_id": "b7e4c1a2-6f38-4d91-8c0e-51a9d2f64b17",
    "name": "Signature Detection API",
    "description": "Detect handwritten signatures in an image or a PDF.\n\n`POST /api/detect` on https://signature-detector.com. Send the `x-api-key` header and exactly one of `imageUrl`, `imageBase64`, `pdfUrl`, or `pdfBase64`. Images cost 1 credit. PDFs cost 1 credit per page. A cached document costs 0 credits.\n\nThe OpenAPI 3.1 document is https://signature-detector.com/openapi.json.\n\nA PDF response has top-level `pages`, `count`, and `creditsUsed`. A short balance returns HTTP 402 and does not charge.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "x-api-key",
        "type": "string"
      },
      {
        "key": "value",
        "value": "{{apiKey}}",
        "type": "string"
      },
      {
        "key": "in",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://signature-detector.com"
    },
    {
      "key": "apiKey",
      "value": "your_api_key_here"
    }
  ],
  "item": [
    {
      "name": "Detect signatures from an image URL",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('status is 200', function () {",
              "  pm.response.to.have.status(200);",
              "});",
              "pm.test('returns bounding boxes', function () {",
              "  const body = pm.response.json();",
              "  pm.expect(body.success).to.eql(true);",
              "  pm.expect(body.result.count).to.be.a('number');",
              "  pm.expect(body.result.detections).to.be.an('array');",
              "  pm.expect(body.creditsRemaining).to.be.a('number');",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"imageUrl\": \"https://example.com/document.jpg\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/detect",
          "host": ["{{baseUrl}}"],
          "path": ["api", "detect"]
        },
        "description": "Detect signatures in an image available at a public URL. Costs 1 credit unless this document is already cached."
      },
      "response": [
        {
          "name": "Fresh detection",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "x-api-key",
                "value": "{{apiKey}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"imageUrl\": \"https://example.com/document.jpg\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/detect",
              "host": ["{{baseUrl}}"],
              "path": ["api", "detect"]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"result\": {\n    \"detections\": [\n      {\n        \"bbox\": { \"x1\": 321.23, \"y1\": 373.39, \"x2\": 647.21, \"y2\": 501.68 },\n        \"confidence\": 0.192,\n        \"class\": 0,\n        \"class_name\": \"signature\"\n      }\n    ],\n    \"count\": 1,\n    \"confidenceThreshold\": 0.1\n  },\n  \"creditsRemaining\": 9999,\n  \"detectionId\": \"clxxxx1234567890\"\n}"
        },
        {
          "name": "Insufficient credits",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "x-api-key",
                "value": "{{apiKey}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"imageUrl\": \"https://example.com/document.jpg\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/detect",
              "host": ["{{baseUrl}}"],
              "path": ["api", "detect"]
            }
          },
          "status": "Payment Required",
          "code": 402,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"error\": \"Insufficient credits. Please purchase more credits to continue.\",\n  \"credits\": 0,\n  \"needsPurchase\": true\n}"
        },
        {
          "name": "Invalid API key",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "x-api-key",
                "value": "sd_invalid"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"imageUrl\": \"https://example.com/document.jpg\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/detect",
              "host": ["{{baseUrl}}"],
              "path": ["api", "detect"]
            }
          },
          "status": "Unauthorized",
          "code": 401,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"error\": \"Invalid API key\"\n}"
        }
      ]
    },
    {
      "name": "Detect signatures from base64",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"imageBase64\": \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/detect",
          "host": ["{{baseUrl}}"],
          "path": ["api", "detect"]
        },
        "description": "Detect signatures in a base64 image. Raw base64 or a data URL (`data:image/<type>;base64,...`) is accepted. Do not send `imageUrl` in the same body."
      },
      "response": []
    },
    {
      "name": "PDF",
      "description": "Send exactly one of `pdfUrl` or `pdfBase64`. Each page costs 1 credit. The response has top-level `pages`, `count`, and `creditsUsed`. A balance below the page count returns HTTP 402 and does not process or charge any page.",
      "item": [
        {
          "name": "Detect signatures from a PDF URL",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pdfUrl\": \"https://example.com/document.pdf\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/detect",
              "host": ["{{baseUrl}}"],
              "path": ["api", "detect"]
            },
            "description": "Detect every page of a PDF URL. Costs 1 credit per page. The saved example shows top-level pages, count, and creditsUsed."
          },
          "response": [
            {
              "name": "Page-grouped detection (PDF API)",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"pdfUrl\": \"https://example.com/document.pdf\"\n}"
                },
                "url": {
                  "raw": "{{baseUrl}}/api/detect",
                  "host": ["{{baseUrl}}"],
                  "path": ["api", "detect"]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"documentType\": \"pdf\",\n  \"signed\": true,\n  \"count\": 1,\n  \"pageCount\": 1,\n  \"confidenceThreshold\": 0.1,\n  \"pages\": [\n    {\n      \"page\": 1,\n      \"width\": 1275,\n      \"height\": 1650,\n      \"detections\": [\n        {\n          \"bbox\": { \"x1\": 321.23, \"y1\": 373.39, \"x2\": 647.21, \"y2\": 501.68 },\n          \"confidence\": 0.192,\n          \"class\": 0,\n          \"class_name\": \"signature\"\n        }\n      ],\n      \"count\": 1\n    }\n  ],\n  \"creditsUsed\": 1,\n  \"creditsRemaining\": 9998,\n  \"detectionId\": \"clxxxxpdf\"\n}"
            }
          ]
        },
        {
          "name": "Detect signatures from PDF base64",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pdfBase64\": \"JVBERi0xLjEKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c+PgplbmRvYmoK\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/detect",
              "host": ["{{baseUrl}}"],
              "path": ["api", "detect"]
            },
            "description": "Send raw base64 or a data URL, and do not also send `pdfUrl`. Costs 1 credit per page."
          },
          "response": []
        }
      ]
    }
  ]
}
