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
-
resourceIdstring · uuid -
documentKeystring -
fileNamestring -
contentTypestring -
metadataobject-
typestring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
AR
-
Response
-
idstring · uuid -
companyIdstring · uuid -
resourceIdstring · uuid -
documentKeystring -
fileNamestring -
contentTypestring -
createdBystring · uuid -
metadataobject-
typestring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
AR
-
-
createdAtstring · date-time -
updatedAtstring · date-time