lorenzo-s
lorenzo-s

Reputation: 17010

Notion API: how to get the URL of uploaded files

I'm using the Notion API Beta, reading pages from a table that has a "Files & media" property I'm interested in. The API response just gives me the names of the files uploaded there, but I don't have a URL to actually access them. What am I missing? Thanks.

{
  "Photo": {
    "id": "xxxx",
    "type": "files",
    "files": [
      {
        "name": "000150748673-ofnuhb-t500x500.jpg"
      }
    ]
  }
}

Update: see answer.


Upvotes: 7

Views: 4100

Answers (2)

lorenzo-s
lorenzo-s

Reputation: 17010

The API has been updated and it now provides a temporary authenticated URL to files uploaded in Notion. For example:

{
  "Photo": {
    "id": "xxxx",
    "type": "files",
    "files": [
      {
        "name": "000150748673-ofnuhb-t500x500.jpg",
        "type": "file",
        "file": {
          "url": "https://s3.us-west-2.amazonaws.com/...",
          "expiry_time": "2021-09-22T09:00:56.029Z"
        }
      }
    ]
  }
}

Upvotes: 5

adlopez15
adlopez15

Reputation: 4417

The Notion API currently does not support file uploads or downloads (Notion-Version: 2021-05-13). It does not return a URL to the stored file.

Upvotes: 4

Related Questions