Notion API
api.notion.com · Company
Read and write to Notion workspaces — pages, databases, blocks, and comments. Automate workflows, sync external data, and build integrations. Free integration token.
Authentication
Bearer Token
Free integration token from notion.so/my-integrations. Pass as Authorization: Bearer YOUR_TOKEN and Notion-Version: 2022-06-28 header.
Sample Requests
POST
Search pages
Search your Notion workspace.
https://api.notion.com/v1/search
Hover any highlighted part to learn what it does
Headers — extra info sent with the request
| Content-Type | application/json |
| Authorization | Bearer YOUR_TOKEN |
| Notion-Version | 2022-06-28 |
Request Body — data you're sending
{
"query": "Meeting notes",
"filter": {
"value": "page",
"property": "object"
}
}
curl -X POST "https://api.notion.com/v1/search" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{"query":"Meeting notes","filter":{"value":"page","property":"object"}}'import requests
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Notion-Version": "2022-06-28"
}
data = {
"query": "Meeting notes",
"filter": {
"value": "page",
"property": "object"
}
}
response = requests.post(
"https://api.notion.com/v1/search",
headers=headers,
json=data,
)
print(response.json())const url = 'https://api.notion.com/v1/search';
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Notion-Version': '2022-06-28'
},
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"query": "Meeting notes",
"filter": {
"value": "page",
"property": "object"
}
}),
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"bytes"
"encoding/json"
)
func main() {
targetURL := "https://api.notion.com/v1/search"
jsonData, _ := json.Marshal({"query":"Meeting notes","filter":{"value":"page","property":"object"}})
req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("Notion-Version", "2022-06-28")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.notion.com/v1/search")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
req["Notion-Version"] = "2022-06-28"
req["Content-Type"] = "application/json"
req.body = "{\"query\":\"Meeting notes\",\"filter\":{\"value\":\"page\",\"property\":\"object\"}}"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.notion.com/v1/search";
$opts = ["http" => [
"method" => "POST",
"header" => implode("\r\n", [
"Content-Type: application/json",
"Authorization: Bearer YOUR_ACCESS_TOKEN",
"Notion-Version: 2022-06-28",
"Content-Type: application/json"
]),
"content" => json_encode({"query":"Meeting notes","filter":{"value":"page","property":"object"}}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
POST
Query a database
Get all rows from a Notion database.
https://api.notion.com/v1/databases/{database_id}/query
Hover any highlighted part to learn what it does
Headers — extra info sent with the request
| Authorization | Bearer YOUR_TOKEN |
| Notion-Version | 2022-06-28 |
curl -X POST "https://api.notion.com/v1/databases/{database_id}/query" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Notion-Version: 2022-06-28"import requests
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Notion-Version": "2022-06-28"
}
response = requests.post(
"https://api.notion.com/v1/databases/{database_id}/query",
headers=headers,
)
print(response.json())const url = 'https://api.notion.com/v1/databases/{database_id}/query';
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Notion-Version': '2022-06-28'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.notion.com/v1/databases/{database_id}/query"
req, _ := http.NewRequest("POST", targetURL, nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("Notion-Version", "2022-06-28")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.notion.com/v1/databases/{database_id}/query")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
req["Notion-Version"] = "2022-06-28"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.notion.com/v1/databases/{database_id}/query";
$opts = ["http" => [
"method" => "POST",
"header" => implode("\r\n", [
"Authorization: Bearer YOUR_ACCESS_TOKEN",
"Notion-Version: 2022-06-28"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Create an integration at notion.so/my-integrations
- Share your Notion page/database with the integration (using Share button)
- Set Authorization: Bearer YOUR_TOKEN
- Set Notion-Version: 2022-06-28 header (required)
- GET /users/me to verify your token works