> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spidra.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Large Files

> Upload files up to 500 MB for parsing with a prepared upload URL, and delete uploaded files.

Direct uploads to [POST /parse](/api-reference/parse/parse) take up to 50 MB. For files up to 500 MB:

1. `POST /api/parse/uploads` with `{ "fileName": "annual-report.pdf", "size": 182345678 }`. The response has a `fileId` and an `uploadUrl`.
2. `PUT` the file's bytes to `uploadUrl` within 15 minutes. No API key is needed for this request.
3. Parse it with `POST /api/parse` and `{ "fileId": "..." }`, plus any options.

```bash theme={null}
curl -X POST https://api.spidra.io/api/parse/uploads \
  -H "Authorization: Bearer $SPIDRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileName": "annual-report.pdf", "size": 182345678}'

curl -X PUT --upload-file annual-report.pdf "<uploadUrl>"

curl -X POST https://api.spidra.io/api/parse \
  -H "Authorization: Bearer $SPIDRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileId": "<fileId>", "pages": "1-50"}'
```

Parsing a `fileId` before the file has been uploaded returns `409`.

## Reusing and deleting files

Every uploaded or linked document gets a `fileId`, valid for 24 hours, so you can parse it again with other pages or another prompt without sending it again. After 24 hours it is deleted.

### Delete an uploaded file

`DELETE /api/parse/files/{fileId}` deletes it now.

```json theme={null}
{ "status": "deleted", "fileId": "deb20323-e511-44e8-b88b-72f52a2defa0" }
```


## OpenAPI

````yaml POST /parse/uploads
openapi: 3.1.0
info:
  title: Spidra API
  version: 1.0.0
  description: >-
    Public API endpoints for web scraping via Spidra. Authenticate with
    `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://api.spidra.io/api
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /parse/uploads:
    post:
      tags:
        - Parse
      summary: Prepare a Large Upload
      description: Returns an uploadUrl to PUT a file of up to 500 MB to, and its fileId.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - fileName
                - size
              properties:
                fileName:
                  type: string
                size:
                  type: integer
                  description: Bytes
      responses:
        '201':
          description: Prepared
          content:
            application/json:
              schema:
                type: object
                properties:
                  fileId:
                    type: string
                  uploadUrl:
                    type: string
                  method:
                    type: string
                    enum:
                      - PUT
                  expiresIn:
                    type: integer
        '413':
          description: Over 500 MB
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
      required:
        - status
        - message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.