{
  "openapi": "3.1.0",
  "info": {
    "title": "upload-api",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://upload.trint.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/": {
      "post": {
        "summary": "Upload and Transcribe",
        "description": "Upload media files directly to Trint for immediate transcription",
        "operationId": "upload",
        "parameters": [
          {
            "name": "language",
            "in": "query",
            "description": "Language to transcribe",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filename",
            "in": "query",
            "description": "The name of the file being uploaded",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "query",
            "description": "The username to attach the uploaded file to. If the parameter is not specified it defaults to the user associated with the API key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "API key authorization",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "metadata",
            "in": "query",
            "description": "Metadata to be included in the callback event",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "detect-speaker-change",
            "in": "query",
            "description": "Automatically split paragraphs based on change of speaker. If the parameter is not specified it default to `true`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "folder-id",
            "in": "query",
            "description": "Id of the folder you would like to upload to directly",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workspace-id",
            "in": "query",
            "description": "ID of the workspace/shared drive you'd like to upload to",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "content-type",
            "in": "header",
            "description": "MIME type of the media being uploaded",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "custom-dictionary",
            "in": "query",
            "description": "Use the Vocab Builder during the transcription of the file. If the parameter is not specified it default to `true`.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["RAW_BODY"],
                "properties": {
                  "RAW_BODY": {
                    "type": "string",
                    "description": "The media file to be transcribed",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"trintId\": \"myTrintId\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "trintId": {
                      "type": "string",
                      "example": "myTrintId"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "Invalid Media\n\nDetails:\n- Some or all media files are in an invalid format.\n- One or more media files exceed the maximum duration limit."
                  }
                }
              }
            }
          },
          "402": {
            "description": "402",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "Transcription blocked, insufficient credit"
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -X POST 'https://upload.trint.com/?filename=myfile.mp4&folder-id=ID' \\\n    -u \"AK-12345ABCDE:this15SECRET_CXJK3ctglt6LOpYxRmZ\" \\\n    -H 'content-type: video/mp4' \\\n    --data-binary @myfile.mp4\n"
            },
            {
              "language": "javascript",
              "code": "const request = require(\"request\");\nconst fs = require(\"fs\");\n\nconst myFile = fs.readFileSync(\"myFile.mp4\");\nconst keyId = \"AK-12345ABCDE\";\nconst keySecret = \"this15SECRET_CXJK3ctglt6LOpYxRmZ\";\n\nconst basicAuth = Buffer.from(`${keyId}:${keySecret}`).toString(\"base64\");\n\nconst options = {\n  method: \"POST\",\n  url: \"https://upload.trint.com/?filename=myfile.mp4&folder-id=ID\",\n  encoding: null,\n  body: myFile,\n  headers: {\n    authorization: `Basic ${basicAuth}`,\n    \"content-type\": \"video/mp4\",\n  },\n};\n\nrequest(options, (error, response, body) => {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n",
              "name": "Node"
            },
            {
              "language": "python",
              "code": "import requests\nfrom requests.auth import HTTPBasicAuth\n\nkeyId = 'AK-12345ABCDE'\nkeySecret = 'this15SECRET_CXJK3ctglt6LOpYxRmZ'\n\nfile = 'file_to_upload.mp4'\nfile_mime_type = 'video/mp4'\nurl = 'https://upload.trint.com/?filename={file}'\n\nheaders = {\n    'accept': 'application/json',\n    'content-type': file_mime_type\n}\n\nwith open(file, 'rb') as fh:\n    response = requests.post(url, auth=HTTPBasicAuth(keyId, keySecret), headers=headers, data=fh)\n\nif response.status_code == 200:\n    print('Response:', response.json())\nelse:\n    print('Failed to retrieve data:', response.status_code)\n"
            }
          ],
          "samples-languages": ["curl", "javascript", "python"]
        }
      }
    },
    "/ingest": {}
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": false
  },
  "x-readme-fauxas": true
}
