---
agentTools:
  projectIndex: https://ownli.readme.io/llms.txt
---

# Upload a file

Upload a file to the Ownli cloud. All files used for check-ins need to be uploaded to the Ownli cloud first.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "OpenAPI definition",
    "version": "v0"
  },
  "servers": [
    {
      "url": "https://api.sandbox.ownli.app",
      "description": "Generated server url"
    }
  ],
  "paths": {
    "/api/file/upload": {
      "post": {
        "tags": [
          "File"
        ],
        "summary": "Upload a file",
        "description": "Upload a file to the Ownli cloud. All files used for check-ins need to be uploaded to the Ownli cloud first.",
        "operationId": "upload_1",
        "parameters": [
          {
            "name": "partnerId",
            "in": "header",
            "description": "Partner Id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientId",
            "in": "header",
            "description": "Client Id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientSecret",
            "in": "header",
            "description": "Client Secret",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "File object created by the upload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters.\nPossible error codes \n1. **ERROR_INVALID_PARAMETERS**",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Authorization error e.g. due to an invalid or missing API keys."
          },
          "403": {
            "description": "Forbidden. \nPossible error codes\n 1. **ERROR_NO_PERMISSIONS_TO_RESOURCE**",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "User not found. \nPossible error codes\n 1. **ERROR_USER_NOT_FOUND**",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal error. \nPossible error codes \n1. **INTERNAL_SERVER_ERROR** \n2. **ERROR_DECODING_FILE**, \n3. **ERROR_UPLOADING_FILE**",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponseDto": {
        "type": "object",
        "properties": {
          "error_code": {
            "type": "string",
            "description": "Error code"
          },
          "error_message": {
            "type": "string",
            "description": "A verbose error message"
          }
        },
        "description": "Error response."
      },
      "FileUploadDto": {
        "required": [
          "file",
          "name",
          "userId"
        ],
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "User defined file name of the file. You can give a name that makes it easier the URL easier to identify. Also it will be helpful to provide a suffix so tools like a Browser, Finder or explorer can display it automatically."
          },
          "file": {
            "type": "string",
            "description": "Base64 encoded string representation of the file."
          },
          "deviceIdentifier": {
            "type": "string",
            "description": "Unique identifier of the device on which the document was uploaded or photo taken."
          },
          "deviceManufacturer": {
            "type": "string",
            "description": "The manufacturer of the device on which the document was uploaded or photo was taken. e.g. Apple, Xiaomi, Samsung, OPPO, OnePlus etc."
          },
          "deviceModel": {
            "type": "string",
            "description": "The model of the device on which the document was uploaded  or photo was taken. e.g. LM-G900, motorola edge, IPad, IPhone 14"
          },
          "deviceOS": {
            "type": "string",
            "description": "The OS of the device on which the document was uploaded or photo was taken. Android 9, iOS 13.2.3 etc."
          },
          "takenOn": {
            "type": "string",
            "description": "[takenOn] The timestamp at which the document was uploaded or photo was taken. (The date should be in the ISO8601 UTC format YYY-MM-DDThh:mm:ss.SSSZ; eg: 2024-01-01T00:00:00.000Z"
          },
          "latitude": {
            "type": "number",
            "description": "Latitude at which photo was taken.",
            "format": "double"
          },
          "longitude": {
            "type": "number",
            "description": "Longitude at which photo was taken.",
            "format": "double"
          }
        },
        "description": "Payload for file."
      },
      "FileDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "description": "Id of the owner"
          },
          "fileUrl": {
            "type": "string",
            "description": "URL of the file"
          },
          "dateUploaded": {
            "type": "string",
            "description": "The timestamp of upload"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 105,
      "1": 149,
      "2": 36,
      "3": 236,
      "4": 14,
      "5": 67,
      "6": 148,
      "7": 138,
      "8": 212,
      "9": 48,
      "10": 246,
      "11": 30
    }
  }
}
```