POST /files

Temporarily uploads a file to Zuva. In order to use a document within Zuva to perform processing on that document, you must first upload the binary data for that document to the Zuva file cache. A successful request will return a file_id, that can be used with other endpoints.

If you wish to skip the OCR processing provided by Zuva, please refer to Using Your Own OCR.

Headers

Authorization (required) - Requires the standard authentication header used in the system.

Content-Type (required) - The content type defines the type of data you are uploading to the service. While the service contains logic that can identify the type of data that’s provided, you may also be explicit by telling the service which type is being provided. To let the service perform this content type identification itself, provide a content type of application/octet-stream.

If you would like to explicitly define the content type based on the data provided, then you can do so with the following types:

  1. application/pdf for all PDFs
  2. text/plain for all text content

Parameters

Request Body - There are no parameters for this request. Rather the request body contains the file content. This content can either contains the binary data of the file (for file types such as PDF or DOCX) or text from a text file..

Code Sample
curl --location --request POST '<base url>/files' 
--header 'Authorization: Bearer <token>'  
--header 'Content-Type: application/octet-stream'  
--data-binary '@/path/to/file/name.ext'
file, _ = zdai.file.create(content = f.read())
Response Codes
  • 201 Created
    The upload completed successfully.
  • 400 Bad Request
    A required header was not specified or has invalid value.
  • 403 Forbidden
    Invalid or missing authentication token.
  • 500 Internal Server Error
    Something went wrong unrelated to the users request.

Response Data

  • file_id

    the identifier of the file uploaded to Zuva. This can be used for further processing in the other API endpoints

  • expiration

    expiration for the uploaded file in Zuva. Default expiry for a file is 24 hours, at which point the file will be removed from the system.

Response
{
    "file_id": "<file_id>",
    "attributes": {
        "content-type": "application/pdf"
    },
    "permissions": [
        ""
    ],
    "expiration": "2021-10-07T12:07:57Z"
}

Need Help?

Couldn’t find the information you were looking for or need more assistance?

Contact us at support@zuva.ai