SweetConnect LogoSweetConnect
ApiShare documents

Share a document with a recipient

Creates a share link for a document and sends an email notification to the recipient. The document must be an asset document or maintenance file. The recipient must either be a new user or an existing user in the same organization. If the recipient is new, a deactivated user account is created and the share link is valid until the user registers. If the recipient exists in a different organization, the request fails. A share notification email is sent with the share link and an optional message. If the email fails to send after creating the share record, the request fails but the share record remains in the database.

Access restricted to roles:

  • admin
  • producer-admin
  • producer-user
  • sales-agent
POST
/v1/shares/{fileId}

Path Parameters

fileId*string

UUID of the file to share

Request Body

application/json

Share document request body containing recipient email, asset ID, and optional message

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://dev.sweetconnect.io/api/storage/v1/shares/a1b2c3d4-e5f6-4789-a012-3456789abcde" \  -H "Content-Type: application/json" \  -d '{    "recipientEmail": "recipient@example.com",    "assetId": "a1b2c3d4-e5f6-7890-a012-3456789abcde"  }'
{
  "data": {}
}
{
  "errors": [
    {
      "errorCode": "BadRequest",
      "message": "The request payload is invalid.",
      "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": "UnprocessableEntity",
      "message": "Operation not allowed for this entity type.",
      "extension": {
        "entityType": "Document"
      }
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "InternalServerError",
      "message": "An unexpected error occurred. See logs for further details or create a support ticket.",
      "extension": {}
    }
  ]
}