File

File represents a file associated with a expense. They can be used to store additional information about a expense.

The File object

Properties

  • file.createdAtdate

    The date and time the entity was created.

  • file.idstring

    The id of the file.

  • file.namestring

    The name of the file.

  • file.sizenumber

    The size of the file.

File object

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  //...
  "file": {
    "id": "673b0dfc23b8c71a21e1965d",
    "name": "expense.pdf",
    "size": 196203,
    "createdAt": "2024-11-18T09:50:52.661Z"
  },
  // ...
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:50:52.663Z"
}

POST/v2/expenses/:id/files/upload

Upload a file

This endpoint allows you to upload a file.

Parameters

  • fileobject

    A file to upload. Make sure that the specifications follow RFC 2388, which defines file transfers for the multipart/form-data protocol.

Request

POST
/v2/expenses/:id/files/upload/:outsourcingId?
curl https://api.lsp.expert/v2/expenses/673b0abc23b8c71a21e1942a/files/upload \
  -u {key}: \
  -F file="@/path/to/a/file.pdf"

Response

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  //...
  "file": {
    "id": "673b0dfc23b8c71a21e1965d",
    "name": "expense.pdf",
    "size": 196203,
    "createdAt": "2024-11-18T09:50:52.661Z"
  },
  // ...
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:50:52.663Z"
}


GET/v2/expenses/:id/files/download

Download a file

This endpoint allows you to download a file for a expense.

Request

GET
/v2/expenses/:id/files
curl https://api.lsp.expert/v2/expenses/673b0abc23b8c71a21e1942a/files \
  -u {key}:

DELETE/v2/expenses/:id/files

Delete a file

This endpoint allows you to delete a file.

Request

DELETE
/v2/expenses/:id/files
curl -X DELETE https://api.lsp.expert/v2/expenses/:673b0abc23b8c71a21e1942a/files \
  -u {key}:

Response

{
  "id": "673b0abc23b8c71a21e1942a",
  "name": "First job",
  //...
  "file": null,
  // ...
  "createdAt": "2024-11-18T09:37:00.109Z",
  "updatedAt": "2024-11-18T09:50:52.663Z"
}