---
title: "Create datafile"
method: POST
path: "/v1/applications/{applicationId}/datafiles"
tags: ["Datafiles"]
---

# Create datafile

`POST /v1/applications/{applicationId}/datafiles`

## Request

- Base URL: `https://api.apply.akahu.nz`
- URL: `https://api.apply.akahu.nz/v1/applications/{applicationId}/datafiles`
- Auth: HTTP bearer

This endpoint creates a new datafile record in a `pending` state.
Each datafile represents a single file, which needs to be uploaded shortly after datafile creation.

If the datafile is not uploaded before the `expires_at` timestamp included in the response, the record will be automatically deleted.

The datafile can be uploaded by making a `PUT` request to the `upload_url` provided in the response.
Datafile have a maximum size of 200MB.

## Path parameters

- `applicationId` string, required

## Request body

- object
  - `name` string, required: The filename of this datafile.
  - `schema` string, required: The name of the schema for this datafile.
  - `content_type` 'application/json', required: The content type of the datafile.

## Response `200`

Success

- object
  - `_id` string, required
  - `expires_at` string, date-time, required
  - `upload_url` string, uri, required

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/akahu/apis/akahu-apply-api.md) - [All operations](https://skmtc.dev/akahu/apis/akahu-apply-api/llms.txt) - [OpenAPI document](https://skmtc.dev/akahu/apis/akahu-apply-api/revisions/3f18eb1ead75?raw)
