Attach File or URL to Row - Request Body for cURL or Python

Thomas Taresch
Thomas Taresch ✭✭✭
edited 10/18/23 in API & Developers

Hi all,

I'm struggling to work out how to attach a URL to a row. In the API doc I can see the request URL, but I can't find an example of the request body. I'd prefer to use cURL, alternatively python.

I would expect something like this


-H "Authorization: Bearer XXXXXXXX" \
-H "Content-Type: application/json" \

Body: {rowid: "attachmenttype": LINK, "name": 'url name', "url": 'url'}

Any help is appreciated.



  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭

    From the docs -

    curl{sheetId}/rows/{rowId}/attachments \
    -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \
    -H "Content-Type: application/msword" \
    -H 'Content-Disposition: attachment; filename="ProgressReport.docx"' \
    -H "Content-Length: FILE_SIZE" \
    -X POST \
    --data-binary @ProgressReport.docx


  • @Ryan Kramer

    thanks for the reply. I have seen the docs, however this example describes how to attach a file, however I want to attach a link.

    It's not clear from the docs how I adjust the curl to attach a url instead.

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭

    @Thomas Taresch ,

    Not sure if I understand what you mean by a link as an attachment but you could add it as a discussion perhaps?

    Something like this -

    response = smartsheet_client.Discussions.create_discussion_on_row(
      9283173393803140,           # sheet_id
      0123456789012345,           # row_id
        'comment': smartsheet.models.Comment({
          'text': '<your link>'


  • @Ryan Kramer

    I really appreciate your help. Unfortunately discussions is not what we are after.

    There is an option to attach a 'URL' to a sheet (see images below). In our case we want to attach the URL to a specific destination (different for each row).

    So I guess the request body will be similar as the one you posted, but I'm haven't got enough API smarts to work out the request body for a URL attachment and per API docs it should be possible.

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭

    I see. I haven't done that before but here is in general how you could attach a file to a row.

    updated_attachment = smartsheet_client.Attachments.attach_file_to_row(
      9283173393803140,       # sheet_id
      0123456789012345,       # row_id
        open('/path/to/ProgressReport.docx', 'rb'),

    My guess is it would be close to this but replacing everything starting from the "open" with your URL related information. May have to try it a few times. I see the respective type of URL supported -

    Attach File or URL to Row

    Attaches a file to the row. The URL can be any of the following:

    • Normal URL (attachmentType "LINK")
    • URL (attachmentType "BOX_COM")
    • Dropbox URL (attachmentType "DROPBOX")
    • Egnyte URL (attachmentType "EGNYTE")
    • Evernote URL (attachmentType "EVERNOTE")
    • Google Drive URL (attachmentType "GOOGLE_DRIVE")
    • OneDrive URL (attachmentType "ONEDRIVE")


  • karthick
    karthick ✭✭✭

    @Thomas Taresch @Ryan Kramer Am also looking for the same one like to attach URL instead of file. I got only file attachment as per API documentation. Have you got any solution on the same.

    Last 2 days was searching and I came across this discussion too. Have tried the below one and its working for me, so thought to share here.

    # Define the URL and attachment type

    url = ""

    attachment_type = "LINK" # You can change this to any supported type as per their documentation

          # Create an Attachment object

          attachment = smartsheet.models.Attachment({

            'attachmentType': attachment_type,

            'url': url


          # Attach the URL to the row

          attachment_result = smartsheet_client.Attachments.attach_url_to_row(