# Upload

The upload endpoint allows you to **overwrite or create a new upload in a collection**. If the collection or upload does not exist, it will automatically be created.

Overwriting data is **generally safe due to processing**. The platform has built-in hooks to notify integrations of changes to a collection. Integrations will then rescan current data, and update accordingly. This allows API integrations to **safely wipe data and provide bulk uploads instead of managing each row**.

However, if you want to only append data to existing uploads - see [inserts](/falkor-dev-docs/groups/insert.md).

## Parameters

| Key          | Type                     |
| ------------ | ------------------------ |
| **REQUIRED** |                          |
| collection   | String (Collection Name) |
| upload       | String (Upload Name)     |
| data         | Array of data rows       |

## Data Row

| Key   | Type                                      |
| ----- | ----------------------------------------- |
| Row 0 | Array of strings representing the headers |
| Row N | Array of Any representing each row        |

## Example

The example below uploads data with 5 columns and n rows. You will notice the first row contains the headers.

{% hint style="info" %}
If the collection or upload does not exist, it will **automatically** be created.
{% endhint %}

```
curl -X POST \
  v1/data/upload\
  -H 'Authorization: Basic <Your Base64 Encoded Token>'\
  -d '{
    "collection" : "Collection 1",
    "upload"     : "Upload 1",
    "data"       : [
        ["User Code","Date","Tasks","KPI"],
        ["001","2020-12-01",1,50],
        ["002","2020-12-01",1,50],
        ...etc
    ]
}'
```

## Success Response

The response returns current information on the collection. The stats property will detail how many uploads are in the collection, and what size the sum of the data is.

```
{
    "status": "success",
    "data": {
        "collection": "My Collection",
        "upload": "Upload 1",
        "stats": {
            "uploads": 1,
            "size": 258,
            "rows": 4
        }
    },
    "hash": "925e88d80a1fa85e4a13749f20aa79c9",
    "response_time": 0.7646100521087646
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://everyday-digital.gitbook.io/falkor-dev-docs/data/upload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
