Light APIv1.0.0

API / Reference / Attachments

Create attachment

POST https://api.light.inc/v1/attachments

Creates a new attachment record

Step three of the upload flow: documentKey is the key returned by POST /v1/attachments/upload-url, and the bytes must already be there — otherwise ATTACHMENT_FILE_NOT_FOUND. A resource can carry at most 10 attachments (ATTACHMENT_NUMBER_FOR_RESOURCE_EXCEEDED); the same documentKey or fileName twice on one resource fails with ATTACHMENT_DOCUMENT_KEY_ALREADY_EXISTS / ATTACHMENT_FILE_NAME_FOR_RESOURCE_ALREADY_EXISTS. resourceId is not validated. metadata is only read when Light emails a sales invoice or customer credit (type: "AR", shouldAttachToEmail); on other resources it has no effect.

Authorization

Send one of these on every request. See Authentication for how to get credentials.

  • API key

    Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.

  • Bearer token

Request body

application/json;charset=UTF-8

  • resourceId string · uuid

  • documentKey string

  • fileName string

  • contentType string

  • metadata object

    • type string

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of AR

Response

  • id string · uuid

  • companyId string · uuid

  • resourceId string · uuid

  • documentKey string

  • fileName string

  • contentType string

  • createdBy string · uuid

  • metadata object

    • type string

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of AR

  • createdAt string · date-time

  • updatedAt string · date-time