# Upload file

> Upload a file with API credentials.

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: embedded-finance/files/upload-file
info:
  title: Upload file
  version: original
  description: Upload a file with API credentials.
servers:
  - url: https://sandbox-baas.onerway.com/embedded-finance
    description: sandbox
  - url: https://baas.onerway.com
    description: production
paths:
  /api/v2/upload/file:
    post:
      summary: Upload file
      description: Upload a file with API credentials.
      parameters:
        - name: apiKey
          in: header
          required: true
          description: API key assigned for Embedded Finance API access.
          schema:
            type: string
            description: API key assigned for Embedded Finance API access.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                fileName:
                  type: string
                  description: File name submitted with the upload request.
                  x-onerway-constraints:
                    - kind: range
                      max: 64
                      unit: characters
                    - kind: rule
                      text: Use the original file name or a merchant-generated file name that
                        preserves the file extension.
                file:
                  type: string
                  description: Binary file stream to upload.
                  x-onerway-constraints:
                    - kind: range
                      max: 15
                      unit: MB
                      text: Maximum file size.
                    - kind: rule
                      text: Send the actual binary file stream in this form-data part. Do not submit a
                        file path string as the field value.
              required:
                - fileName
                - file
            examples:
              default:
                summary: Upload file
                value:
                  fileName: back.png
                  file: '@"/path/to/back.png"'
      responses:
        "200":
          description: Upload succeeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: Response code returned by Onerway. `20000` means the file upload
                      succeeded.
                  respMsg:
                    type: string
                    description: Human-readable response message.
                  data:
                    type: object
                    properties:
                      merchantNo:
                        type: string
                        description: Merchant number associated with the uploaded file.
                      fileId:
                        type: integer
                        description: File ID returned after the file is uploaded successfully.
                    description: Uploaded file metadata returned after the file is uploaded
                      successfully.
              examples:
                success:
                  summary: Upload succeeded
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      merchantNo: 800***
                      fileId: 987654321
      security:
        - apiKeyAuth:
            []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apiKey
```
