---
updatedAt: 2026-06-30T03:16:32.000Z
agentTools:
  projectIndex: https://developers.akahu.nz/llms.txt
---

# List datafiles for application

# OpenAPI definition

```json
{
  "info": {
    "title": "Akahu Apply API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.apply.akahu.nz",
      "description": "Akahu Apply API"
    }
  ],
  "x-readme": {
    "apply-endpoint-order": true
  },
  "openapi": "3.1.0",
  "components": {
    "securitySchemes": {
      "APIKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer auth using an Akahu Apply API Key. These can be generated by an Akahu Apply administrator in the web portal."
      }
    },
    "schemas": {
      "WebhookEventId": {
        "type": "string",
        "pattern": "^evt_[a-z0-9]{24,27}$",
        "example": "evt_tz4a98xxat96iws9zmbrgj3a"
      },
      "OrgId": {
        "type": "string",
        "pattern": "^org_[a-z0-9]{24,27}$",
        "example": "org_tz4a98xxat96iws9zmbrgj3a"
      },
      "WebhookEndpointId": {
        "type": "string",
        "pattern": "^webhook_[a-z0-9]{24,27}$",
        "example": "webhook_tz4a98xxat96iws9zmbrgj3a"
      },
      "TestWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "test"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_endpoint": {
            "$ref": "#/components/schemas/WebhookEndpointId"
          }
        },
        "required": [
          "type",
          "_org",
          "_endpoint"
        ]
      },
      "TestWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/TestWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ApplicationId": {
        "type": "string",
        "pattern": "^application_[a-z0-9]{24,27}$",
        "example": "application_tz4a98xxat96iws9zmbrgj3a"
      },
      "ApplicationCreatedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application:created"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application"
        ]
      },
      "ApplicationCreatedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ApplicationCreatedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ApplicationArchivedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application:archived"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application"
        ]
      },
      "ApplicationArchivedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ApplicationArchivedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ApplicationUnarchivedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application:unarchived"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application"
        ]
      },
      "ApplicationUnarchivedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ApplicationUnarchivedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "SharingRequestId": {
        "type": "string",
        "pattern": "^sharing_request_[a-z0-9]{24,27}$",
        "example": "sharing_request_tz4a98xxat96iws9zmbrgj3a"
      },
      "SharingRequestViewedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "sharing_request:viewed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_sharing_request": {
            "$ref": "#/components/schemas/SharingRequestId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_sharing_request"
        ]
      },
      "SharingRequestViewedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/SharingRequestViewedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "SharingRequestSubmittedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "sharing_request:submitted"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_sharing_request": {
            "$ref": "#/components/schemas/SharingRequestId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_sharing_request"
        ]
      },
      "SharingRequestSubmittedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/SharingRequestSubmittedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "DocumentId": {
        "type": "string",
        "pattern": "^doc_[a-z0-9]{24,27}$",
        "example": "doc_tz4a98xxat96iws9zmbrgj3a"
      },
      "DocumentUploadedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "document:uploaded"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_document": {
            "$ref": "#/components/schemas/DocumentId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_document"
        ]
      },
      "DocumentUploadedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/DocumentUploadedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "DocumentCompletedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "document:completed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_document": {
            "$ref": "#/components/schemas/DocumentId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_document"
        ]
      },
      "DocumentCompletedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/DocumentCompletedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "DocumentFailedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "document:failed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_document": {
            "$ref": "#/components/schemas/DocumentId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_document"
        ]
      },
      "DocumentFailedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/DocumentFailedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReportId": {
        "type": "string",
        "pattern": "^report_[a-z0-9]{24,27}$",
        "example": "report_tz4a98xxat96iws9zmbrgj3a"
      },
      "ReportCompletedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "report:completed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_report": {
            "$ref": "#/components/schemas/ReportId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_report"
        ]
      },
      "ReportCompletedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReportCompletedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReportFailedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "report:failed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_report": {
            "$ref": "#/components/schemas/ReportId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_report"
        ]
      },
      "ReportFailedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReportFailedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReferralId": {
        "type": "string",
        "pattern": "^referral_[a-z0-9]{24,27}$",
        "example": "referral_tz4a98xxat96iws9zmbrgj3a"
      },
      "ReferralCreatedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral:created"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_referral": {
            "$ref": "#/components/schemas/ReferralId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_referral"
        ]
      },
      "ReferralCreatedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReferralCreatedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReferralRevokedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral:revoked"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_referral": {
            "$ref": "#/components/schemas/ReferralId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_referral"
        ]
      },
      "ReferralRevokedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReferralRevokedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReferralRedeemedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral:redeemed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          },
          "_referral": {
            "$ref": "#/components/schemas/ReferralId"
          }
        },
        "required": [
          "type",
          "_org",
          "_application",
          "_referral"
        ]
      },
      "ReferralRedeemedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReferralRedeemedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReferralRedemptionId": {
        "type": "string",
        "pattern": "^referral_redemption_[a-z0-9]{24,27}$",
        "example": "referral_redemption_tz4a98xxat96iws9zmbrgj3a"
      },
      "ReferralRedemptionCreatedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral_redemption:created"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_referral_redemption": {
            "$ref": "#/components/schemas/ReferralRedemptionId"
          }
        },
        "required": [
          "type",
          "_org",
          "_referral_redemption"
        ]
      },
      "ReferralRedemptionCreatedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReferralRedemptionCreatedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReferralRedemptionCompletedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral_redemption:completed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_referral_redemption": {
            "$ref": "#/components/schemas/ReferralRedemptionId"
          },
          "_application": {
            "$ref": "#/components/schemas/ApplicationId"
          }
        },
        "required": [
          "type",
          "_org",
          "_referral_redemption",
          "_application"
        ]
      },
      "ReferralRedemptionCompletedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReferralRedemptionCompletedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "ReferralRedemptionFailedWebhookPayload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral_redemption:failed"
            ]
          },
          "_org": {
            "$ref": "#/components/schemas/OrgId"
          },
          "_referral_redemption": {
            "$ref": "#/components/schemas/ReferralRedemptionId"
          }
        },
        "required": [
          "type",
          "_org",
          "_referral_redemption"
        ]
      },
      "ReferralRedemptionFailedWebhookEvent": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/WebhookEventId"
          },
          "emitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/ReferralRedemptionFailedWebhookPayload"
          }
        },
        "required": [
          "_id",
          "emitted_at",
          "payload"
        ]
      },
      "X-Akahu-Apply-Signature": {
        "type": "string",
        "description": "Detached JWS over the request body, signed with `ES256`. The signing key is published at https://api.apply.akahu.nz/.well-known/jwks.json",
        "example": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjAwMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDAwMCJ9..c2lnbmF0dXJl"
      },
      "X-Akahu-Apply-Request-Id": {
        "type": "string",
        "description": "Unique per delivery attempt, including retries. Quote it when asking us about a delivery. Not an idempotency key - use the event `_id` for that.",
        "example": "00000000-0000-4000-8000-000000000000"
      },
      "Generic400ErrorResponseCode": {
        "type": "string",
        "enum": [
          "invalid_type",
          "too_big",
          "too_small",
          "invalid_format",
          "not_multiple_of",
          "unrecognized_keys",
          "invalid_union",
          "invalid_key",
          "invalid_element",
          "invalid_value",
          "invalid",
          "invalid_id"
        ]
      },
      "IssuePath": {
        "type": "array",
        "items": {
          "title": "IssuePathSegment",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            }
          ]
        }
      },
      "Generic400ErrorResponse": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Generic400ErrorResponseCode"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "$ref": "#/components/schemas/IssuePath"
                }
              },
              "required": [
                "code",
                "message",
                "path"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      },
      "Generic401ErrorResponseCode": {
        "type": "string",
        "enum": [
          "unauthorized"
        ]
      },
      "Generic401ErrorResponse": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Generic401ErrorResponseCode"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "$ref": "#/components/schemas/IssuePath"
                }
              },
              "required": [
                "code",
                "message",
                "path"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      },
      "Generic403ErrorResponseCode": {
        "type": "string",
        "enum": [
          "forbidden"
        ]
      },
      "Generic403ErrorResponse": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Generic403ErrorResponseCode"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "$ref": "#/components/schemas/IssuePath"
                }
              },
              "required": [
                "code",
                "message",
                "path"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      },
      "Generic404ErrorResponseCode": {
        "type": "string",
        "enum": [
          "not_found"
        ]
      },
      "Generic404ErrorResponse": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Generic404ErrorResponseCode"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "$ref": "#/components/schemas/IssuePath"
                }
              },
              "required": [
                "code",
                "message",
                "path"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      },
      "Generic429ErrorResponseCode": {
        "type": "string",
        "enum": [
          "too_many_requests"
        ]
      },
      "Generic429ErrorResponse": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Generic429ErrorResponseCode"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "$ref": "#/components/schemas/IssuePath"
                }
              },
              "required": [
                "code",
                "message",
                "path"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      },
      "Generic500ErrorResponseCode": {
        "type": "string",
        "enum": [
          "internal_error"
        ]
      },
      "Generic500ErrorResponse": {
        "type": "object",
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Generic500ErrorResponseCode"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "$ref": "#/components/schemas/IssuePath"
                }
              },
              "required": [
                "code",
                "message",
                "path"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      },
      "DatafileId": {
        "type": "string",
        "pattern": "^dat_[a-z0-9]{24,27}$",
        "example": "dat_tz4a98xxat96iws9zmbrgj3a"
      },
      "DatafileStatus": {
        "type": "string",
        "enum": [
          "pending",
          "processing",
          "completed",
          "failed"
        ],
        "description": "The status of a datafile:\n\n - `pending` The datafile record exists, but the file has not yet been fully uploaded.\n\n - `processing` Akahu Apply is extracting and enriching the data from this datafile.\n\n - `completed` This datafile has been successfully processed.\n\n - `failed` This datafile has not been successfully processed. See the `failure_reason` for more detail."
      },
      "DatafileFailureReasonCode": {
        "type": "string",
        "enum": [
          "internal_error",
          "invalid_input",
          "timeout",
          "malware_scan_failed",
          "malware_detected"
        ]
      },
      "Datafile": {
        "type": "object",
        "properties": {
          "_id": {
            "$ref": "#/components/schemas/DatafileId"
          },
          "_application": {
            "type": "string",
            "pattern": "^application_[a-z0-9]{24,27}$",
            "example": "application_tz4a98xxat96iws9zmbrgj3a",
            "description": "The application that this datafile belongs to."
          },
          "name": {
            "type": "string",
            "maxLength": 255,
            "description": "The filename of this datafile."
          },
          "content_type": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "description": "The content type of the datafile."
          },
          "schema": {
            "type": "string",
            "description": "The name of the schema for this datafile."
          },
          "status": {
            "$ref": "#/components/schemas/DatafileStatus"
          },
          "failure_reason": {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/DatafileFailureReasonCode"
              },
              "message": {
                "type": "string",
                "default": "Sorry, something went wrong while processing this datafile. Please try again later."
              }
            },
            "required": [
              "code"
            ],
            "description": "If this datafile has failed to be processed, this field provides additional detail about what went wrong."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date that this datafile was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date that this datafile was last updated at."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Expiry for the datafile, after which the record will be deleted. Expiry varies as the datafile progresses through its lifecycle:\n\n - While the datafile has a status of `pending`, expiry is short lived, ensuring that the record is cleaned up quickly if a file is never uploaded.\n\n - After the datafile upload has been received, a 1 year expiry is set, after which the datafile and all associated data will be permanently deleted."
          }
        },
        "required": [
          "_id",
          "_application",
          "name",
          "content_type",
          "schema",
          "status",
          "created_at",
          "updated_at"
        ],
        "description": "**Datafiles** are a structured way to bring financial data into an Application for analysis.\n\nA datafile represents a single file containing a financial information, that follows a supported schema.\n\nWhen a datafile is uploaded to an Application, Akahu Apply will process the information from the file and convert it to a standardised format.\n\nDatafiles can be added to an application only via this API.\n\nNote: Datafiles and their associated data expire 1 year after creation."
      }
    },
    "parameters": {
      "X-Akahu-Apply-Signature": {
        "schema": {
          "$ref": "#/components/schemas/X-Akahu-Apply-Signature"
        },
        "required": true,
        "description": "Detached JWS over the request body, signed with `ES256`. The signing key is published at https://api.apply.akahu.nz/.well-known/jwks.json",
        "name": "X-Akahu-Apply-Signature",
        "in": "header"
      },
      "X-Akahu-Apply-Request-Id": {
        "schema": {
          "$ref": "#/components/schemas/X-Akahu-Apply-Request-Id"
        },
        "required": true,
        "description": "Unique per delivery attempt, including retries. Quote it when asking us about a delivery. Not an idempotency key - use the event `_id` for that.",
        "name": "X-Akahu-Apply-Request-Id",
        "in": "header"
      }
    }
  },
  "paths": {
    "/v1/applications/{applicationId}/datafiles": {
      "get": {
        "operationId": "ListDatafiles",
        "tags": [
          "Datafiles"
        ],
        "summary": "List datafiles for application",
        "deprecated": false,
        "security": [
          {
            "APIKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "$ref": "#/components/schemas/ApplicationId"
            },
            "required": true,
            "name": "applicationId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Datafile"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generic400ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generic401ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generic403ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generic404ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generic429ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generic500ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "Test": {
      "post": {
        "operationId": "Test",
        "summary": "test",
        "description": "A manually triggered test event for a specific endpoint.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ApplicationCreated": {
      "post": {
        "operationId": "ApplicationCreated",
        "summary": "application:created",
        "description": "An application was created.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ApplicationArchived": {
      "post": {
        "operationId": "ApplicationArchived",
        "summary": "application:archived",
        "description": "An application was archived.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationArchivedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ApplicationUnarchived": {
      "post": {
        "operationId": "ApplicationUnarchived",
        "summary": "application:unarchived",
        "description": "An archived application was restored to active.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationUnarchivedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "SharingRequestViewed": {
      "post": {
        "operationId": "SharingRequestViewed",
        "summary": "sharing_request:viewed",
        "description": "An applicant opened a sharing request link.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SharingRequestViewedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "SharingRequestSubmitted": {
      "post": {
        "operationId": "SharingRequestSubmitted",
        "summary": "sharing_request:submitted",
        "description": "An applicant submitted data against a sharing request.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SharingRequestSubmittedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "DocumentUploaded": {
      "post": {
        "operationId": "DocumentUploaded",
        "summary": "document:uploaded",
        "description": "A document was uploaded to an application.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentUploadedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "DocumentCompleted": {
      "post": {
        "operationId": "DocumentCompleted",
        "summary": "document:completed",
        "description": "A document finished processing successfully.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCompletedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "DocumentFailed": {
      "post": {
        "operationId": "DocumentFailed",
        "summary": "document:failed",
        "description": "A document failed to process.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFailedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReportCompleted": {
      "post": {
        "operationId": "ReportCompleted",
        "summary": "report:completed",
        "description": "A report finished generating successfully.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportCompletedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReportFailed": {
      "post": {
        "operationId": "ReportFailed",
        "summary": "report:failed",
        "description": "A report failed to generate.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportFailedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReferralCreated": {
      "post": {
        "operationId": "ReferralCreated",
        "summary": "referral:created",
        "description": "A referral was created from an application.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferralCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReferralRevoked": {
      "post": {
        "operationId": "ReferralRevoked",
        "summary": "referral:revoked",
        "description": "A referral was revoked. Not sent when a referral expires.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferralRevokedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReferralRedeemed": {
      "post": {
        "operationId": "ReferralRedeemed",
        "summary": "referral:redeemed",
        "description": "Another organisation redeemed a referral.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferralRedeemedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReferralRedemptionCreated": {
      "post": {
        "operationId": "ReferralRedemptionCreated",
        "summary": "referral_redemption:created",
        "description": "A referral redemption was started.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferralRedemptionCreatedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReferralRedemptionCompleted": {
      "post": {
        "operationId": "ReferralRedemptionCompleted",
        "summary": "referral_redemption:completed",
        "description": "A referral redemption finished and the new application is available.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferralRedemptionCompletedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    },
    "ReferralRedemptionFailed": {
      "post": {
        "operationId": "ReferralRedemptionFailed",
        "summary": "referral_redemption:failed",
        "description": "A referral redemption failed.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Signature"
          },
          {
            "$ref": "#/components/parameters/X-Akahu-Apply-Request-Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferralRedemptionFailedWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event acknowledged."
          }
        }
      }
    }
  }
}
```