# Upload a file

`POST /files/{id}`



[Files API guide](https://docs.contextual.io/legacy/tenants/tenant-apis/files-api.md)

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Files Api",
    "description": " ",
    "version": "1.6.3"
  },
  "security": [
    {
      "jwt": []
    }
  ],
  "servers": [
    {
      "url": "https://files.prod-001.prod.contextual.io/api/v1"
    }
  ],
  "paths": {
    "/files/{id}": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Upload a file",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "deprecated": false,
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authorization header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Invalid permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "File not found or already uploaded",
            "content": {}
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "jwt": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "File": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "meta": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string"
                  },
                  "contentType": {
                    "type": "string"
                  },
                  "contentMD5": {
                    "type": "string"
                  },
                  "size": {
                    "type": "number"
                  }
                },
                "required": [
                  "path",
                  "contentType",
                  "size"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            ]
          },
          "_metaData": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "pattern": "^(?:\\d+(?:\\.\\d+?)?|(?:\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z))$",
                "description": "An ISO 8601 date time string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "pattern": "^(?:\\d+(?:\\.\\d+?)?|(?:\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z))$",
                "description": "An ISO 8601 date time string",
                "format": "date-time"
              },
              "ref": {
                "type": "object",
                "properties": {
                  "namespace": {
                    "type": "string",
                    "const": "native-object"
                  },
                  "typeId": {
                    "type": "string"
                  },
                  "instanceId": {
                    "type": "string"
                  }
                },
                "required": [
                  "namespace",
                  "typeId",
                  "instanceId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "createdAt",
              "ref"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "filename",
          "meta",
          "_metaData"
        ],
        "additionalProperties": false
      },
      "$ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "number"
            ]
          },
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      }
    }
  }
}
```