---
updatedAt: 2026-09-08T02:02:13.000Z
agentTools:
  siteIndex: https://docs.affirm.com/llms.txt
  projectIndex: https://docs.affirm.com/developers/llms.txt
---

# Submits a request to upload the file.

Submits a request to upload the file.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "description": "Files API",
    "version": "0.0.1",
    "title": "Affirm Files API",
    "termsOfService": "https://www.affirm.com/terms",
    "contact": {
      "name": "Merchant Interfaces",
      "url": "https://coda.io/d/Merchant-Interfaces_d8L8vZX7Cbt",
      "email": "mint-eng@affirm.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "servers": [
    {
      "url": "https://sandbox.affirm.com/api/partner/v1"
    },
    {
      "url": "https://api.affirm.com/api/partner/v1"
    }
  ],
  "paths": {
    "/files": {
      "post": {
        "tags": [
          "Files API"
        ],
        "summary": "Submits a request to upload the file.",
        "description": "Submits a request to upload the file.",
        "x-openapi-router-controller": "affirm.partner_api.http.apis.files.v1.impl",
        "operationId": "create_file_upload",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "description": "Key used to serve subsequent retries of a request",
            "example": "0ddb9813-e62d-4370",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "File Upload request.",
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CreateFileUploadRequest"
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Invalid Input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidInputError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedAccess"
                }
              }
            }
          },
          "413": {
            "description": "Request entity too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestEntityTooLarge"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          },
          "2XX": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUploadResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateFileUploadRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "The file to upload, in binary format."
          },
          "purpose": {
            "type": "string",
            "description": "A value indicating the purpose of the uploaded file.",
            "enum": [
              "dispute_evidence"
            ],
            "example": "dispute_evidence"
          },
          "file_name": {
            "type": "string",
            "description": "A value indicating the name of the file.",
            "maxLength": 25,
            "example": "evidence.pdf"
          },
          "merchant_id": {
            "type": "string",
            "description": "An optional value indicating the id of the merchant.",
            "example": "21FA1V8NLZAQGOK6"
          }
        },
        "required": [
          "file",
          "file_name",
          "purpose"
        ]
      },
      "FileUploadResponse": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "A unique identifier for file object."
          },
          "file_name": {
            "type": "string",
            "description": "A value indicating the name of the file.",
            "example": "evidence.pdf"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "Date that the file was uploaded.",
            "example": "2024-03-02T14:29:07Z"
          },
          "purpose": {
            "type": "string",
            "description": "A value indicating the purpose of the uploaded file.",
            "enum": [
              "dispute_evidence"
            ],
            "example": "dispute_evidence"
          }
        },
        "required": [
          "created",
          "file_id",
          "file_name",
          "purpose"
        ]
      },
      "InternalServerError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "internal_server_error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "InvalidInputError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "invalid_file_mime_type",
              "invalid_file_name",
              "idempotency_data_conflict",
              "idempotency_key_invalid"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "RequestEntityTooLarge": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "request_entity_too_large"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "UnauthorizedAccess": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "not_found"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "UnauthorizedError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "api-key-pair-invalid",
              "unauthorized"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      },
      "Forbidden": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "forbidden"
            ],
            "description": "Error Codes:\n  * `forbidden` - Corresponding File ID still pending virus scanning\n"
          },
          "message": {
            "type": "string",
            "description": "Human readable message with details about the error."
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```

# Sibling pages

* [Get file download link by ID.](https://docs.affirm.com/developers/reference/get_file_download-partner-files-api.md)