SweetConnect LogoSweetConnect
ApiDocuments

Update a document by file ID

Updates an existing document's metadata and optionally replaces the physical file. File replacement is restricted to asset documents only - other document types cannot have their files replaced, but metadata can still be updated.

Access restricted to roles:

  • admin
  • manufacturer-admin
  • manufacturer-user
  • producer-admin
  • producer-user
PATCH
/v1/documents/{fileId}
AuthorizationBearer <token>

In: header

Path Parameters

fileId*string

The ID of the file to update.

Request Body

multipart/form-data

Request payload for updating a document.

displayname?string

Display name for the file

languageCodes?array<string>

Array of language codes associated with the document

categoryId?string

Category identifier for the file

supplierDocument?boolean

Whether this is a supplier document

supplierName?string

Name of the supplier

file?string

The file to replace the original with

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://my.sweetconnect.io/api/storage/v1/documents/string"
{
  "data": {
    "id": "a3f2b65e-4f22-4f45-80c4-9e547a8f5e6a",
    "filename": "document.pdf",
    "displayname": "Manual 2025",
    "ownerId": "d1f2g3h4-i5j6-k7l8-m9n0",
    "organizationId": "d1f2g3h4-i5j6-k7l8-m9n0",
    "manufacturerId": "d1f2g3h4-i5j6-k7l8-m9n0",
    "mimetype": "application/pdf",
    "category": {
      "id": "AA",
      "languageCode": "en",
      "name": "Electronics"
    },
    "languages": [
      "de",
      "fr"
    ],
    "updatedAt": "2025-02-27T12:00:00.000Z",
    "updatedBy": "user-1234abcd",
    "createdBy": "user-5678efgh",
    "createdAt": "2025-01-15T09:30:00.000Z",
    "supplierDocument": false,
    "supplierName": "Amcor",
    "aiInjected": "uninjected",
    "aiInjectedUpdatedAt": "2025-02-27T14:30:00.000Z"
  }
}
{
  "errors": [
    {
      "errorCode": "Conflict",
      "message": "A conflict occurred due to duplicate data or resource state issues.",
      "extension": {}
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "Unauthorized",
      "message": "Authentication is required to access this resource.",
      "extension": {}
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "NoPermission",
      "message": "You do not have permission to access this resource.",
      "extension": {}
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "NotFound",
      "message": "The requested resource was not found.",
      "extension": {}
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "InternalServerError",
      "message": "An unexpected internal server error occurred.",
      "extension": {}
    }
  ]
}