{
  "swagger": "2.0",
  "info": {
    "version": "Swagger 2.0",
    "title": "https://services.forecastica.com"
  },
  "basePath": "https://services.forecastica.com",
  "securityDefinitions": {
    "Bearer": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header",
      "description": "Send Authorization Header for all API calls with value: Bearer API-KEY (Your API KEY was returned in JSON returned during registration"
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ],
  "paths": {
    "/aws/api/pdf/redact": {
      "post": {
        "operationId": "Synchronous PDF Redaction",
        "consumes": [
          "multipart/form-data"
        ],
        "produces": [
          "application/pdf"
        ],
        "parameters": [
          {
            "name": "redaction_config",
            "in": "formData",
            "description": "JSON string of RedactionConfig",
            "required": false,
            "type": "string"
          },
          {
            "name": "file",
            "in": "formData",
            "description": "value must be \"file:fileName (e.g. test.pdf) must incldue colon\"",
            "required": true,
            "type": "file"
          }
        ],
        "responses": {
          "200": {
            "description": "The redacted PDF file",
            "schema": {
              "type": "file"
            }
          }
        }
      }
    },
    "/aws/api/pdf/redact/asynch": {
      "post": {
        "operationId": "Asynchronous PDF Redaction (returns JobResponse with jobId.  Use jobId in /aws/api/pdf/redact/jobId/{jobId} to poll for redacted PDF",
        "consumes": [
          "multipart/form-data"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
	              "name": "redaction_config",
	              "in": "formData",
	              "description": "JSON string of RedactionConfig",
	              "required": false,
	              "type": "string"
          },
          {
            "name": "file",
            "in": "formData",
            "description": "value must be \"file:fileName (e.g. test.pdf) must include colon\"",
            "required": true,
            "type": "file"
          }
        ],
        "responses": {
          "202": {
            "description": "Job accepted",
            "schema": {
              "$ref": "#/definitions/JobResponse"
            }
          }
        }
      }
    },
    "/aws/api/pdf/redact/jobId/{jobId}": {
      "get": {
        "operationId": "Get Redacted/Flattened/Shrinked PDF Result (Returns JobResponse with status Processing | Pending | Failed or redacted PDF)",
        "produces": [
          "application/pdf"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "The redacted PDF file",
            "schema": {
              "type": "file"
            }
          }
        }
      }
    },
    "/aws/api/pdf/shrink": {
      "post": {
        "operationId": "Shrink PDF Resolution",
        "consumes": [
          "multipart/form-data"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "file",
            "in": "formData",
            "description": "value must be \"file:fileName (e.g. test.pdf) must include colon\"",
            "required": true,
            "type": "file"
          },
          {
            "name": "scaleFactor",
            "in": "query",
            "description": "Scaling factor for resolution. Reference:\n- 1.0: 100% (Original), No Change. Use for Archival.\n- 0.75: 75% Res, ~56% size. Use for sharing.\n- 0.50: 50% Res, 25% size. Use for Mobile/Fast loading. (Pro Tip: This is the 'sweet spot' for professional use, offering massive size reduction while remaining perfectly readable on tablets and laptops.)\n- 0.33: 33% Res, ~11% size. Use for Drafts.\n- 0.25: 25% Res, ~6% size. Use for Previews.",
            "required": true,
            "type": "number",
            "enum": [
              1,
              0.75,
              0.5,
              0.33,
              0.25
            ]
          }
        ],
        "responses": {
          "202": {
            "description": "Shrink job accepted",
            "schema": {
              "$ref": "#/definitions/JobResponse"
            }
          }
        }
      }
    },
    "/aws/api/pdf/shrink/jobId/{jobId}": {
      "get": {
        "operationId": "Get Shrunk PDF Result (Returns JobResponse with status Processing | Failed | Pending or shrinked PDF)",
        "produces": [
          "application/pdf"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "The shrunk PDF file",
            "schema": {
              "type": "file"
            }
          }
        }
      }
    },
    "/aws/api/pdf/flatten": {
      "post": {
        "operationId": "Flatten PDF Forms",
        "consumes": [
          "multipart/form-data"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "file",
            "in": "formData",
            "description": "value must be \"file:fileName (e.g. test.pdf) must include colon\"",
            "required": true,
            "type": "file"
          }
        ],
        "responses": {
          "202": {
            "description": "Flatten job accepted",
            "schema": {
              "$ref": "#/definitions/JobResponse"
            }
          }
        }
      }
    },
    "/aws/api/pdf/flatten/jobId/{jobId}": {
      "get": {
        "operationId": "Get Flattened PDF Result (Returns JobResponse with status Processing | Failed | Pending or flattened PDF)",
        "produces": [
          "application/pdf"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "The flattened PDF file",
            "schema": {
              "type": "file"
            }
          }
        }
      }
    },
    "/aws/api/text/redact": {
      "post": {
        "operationId": "Redact Text Content",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "description": "Text redaction request object",
            "required": true,
            "schema": {
              "$ref": "#/definitions/TextRedactionRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The redacted text and metadata",
            "schema": {
              "$ref": "#/definitions/TextRedactionResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "JobResponse": {
      "type": "object",
      "properties": {
        "jobId": {
          "type": "string",
          "example": "aadf167a-f583-478e-bd25-1fa2947bb5a6"
        },
        "status": {
		          "type": "string",
		          "example": "Processing | Pending | Failed (keep polling for PDF response)"
	}
      }
    },
    "RedactionConfig": {
      "type": "object",
      "properties": {
        "types": {
          "type": "array",
          "description": "See list of all entity types at http://www.jcentricity.com/types.html",
          "items": {
            "type": "string",
            "enum": [
              "EMAIL_ADDRESS",
              "SSN"
            ]
          }
        },
        "regex": {
          "type": "array",
          "description": "sample [\"\\\\b\\\\d{3}-\\\\d{2}-\\\\d{4}\\\\b\"] ensure backslashes are escaped and beginning \\\\b and ending \\\\b included or else you will get HTTP 500 error",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "TextRedactionRequest": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "default": ""
        },
        "types": {
          "type": "array",
          "description": "See list of all entity types at http://www.jcentricity.com/types.html",
          "items": {
            "type": "string"
          }
        },
        "mask_char": {
          "type": "string",
          "default": "#"
        },
        "regex": {
          "type": "array",
          "description": "sample [\"\\\\b\\\\d{3}-\\\\d{2}-\\\\d{4}\\\\b\"] ensure backslashes are escaped and beginning \\\\b and ending \\\\b included or else you will get HTTP 500 error",
          "items": {
            "type": "string"
          }
        },
        "format": {
          "type": "string",
          "description": "structured will replace redacted words with entity type such as [SSN], [EMAIL_ADDRESS], [EIN] and mask will mask redacted words with mask character",
          "enum": [
            "structured",
            "mask"
          ]
        }
      }
    },
    "TextRedactionResponse": {
      "type": "object",
      "properties": {
        "redacted": {
          "type": "string",
          "example": "Employee Sarah Johnson (redacted) SSN: [SSN] | Phone: +1 (555) 123-4567"
        },
        "masked": {
          "type": "string",
          "example": "Employee Sarah Johnson (#######) SSN: ########### | Phone: +1 (555) 123-4567"
        },
        "detected_types": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "example": [
            "REGEX"
          ]
        }
      }
    }
  }
}