{
  "swagger": "2.0",
  "info": {
    "version": "1.0",
    "description": "<h3>Document upload API documentation </h3> <b>Published Date:</b> 23-Aug-2022 <b>Author: </b> Shashi Kumar S K, Yashar Rahvar <b> Requirement:</b> New API added for document upload  <b>Version History:</b>Document upload API is added",
    "title": "Document upload "
  },
  "host": "cft-api-mgmt.demo.platform.hmcts.net",
  "basePath": "/prl-document-api",
  "schemes": [
    "https"
  ],
  "securityDefinitions": {
    "apiKeyHeader": {
      "type": "apiKey",
      "name": "Ocp-Apim-Subscription-Key",
      "in": "header"
    },
    "apiKeyQuery": {
      "type": "apiKey",
      "name": "auth-token",
      "in": "header"
    }
  },
  "security": [
    {
      "apiKeyHeader": []
    }
  ],
  "paths": {
    "/{caseId}/document": {
      "post": {
        "description": "Uploads document for a specific case in CCD",
        "operationId": "documentUpload",
        "summary": "Upload document",
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "type": "string",
            "description": "CCD ID for which document will be uploaded"
          },
          {
            "name": "file",
            "in": "formData",
            "required": true,
            "type": "file",
            "description": "Document which needs to be attached to a case"
          },
          {
            "name": "typeOfDocument",
            "in": "formData",
            "required": true,
            "type": "string",
            "description": "Type of document which is being attached"
          }
        ],
        "consumes": [
          "multipart/form-data"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "201": {
            "description": "Document is uploaded",
            "examples": {
              "application/json": {
                "message": "Document has been uploaded successfully: xyz.pdf"
              }
            }
          },
          "400": {
            "description": "Bad request"
          },
          "403": {
            "description": "Failed authorisation"
          },
          "404": {
            "description": "Not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    }
  }
}
