TypeScript SDK
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.dataSources.create({
parent: {
database_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
title: [{ text: { content: "My Data Source" } }],
properties: {
Name: { title: {} },
Status: {
select: {
options: [
{ name: "To Do", color: "red" },
{ name: "Done", color: "green" }
]
}
}
}
})curl --request POST \
--url https://api.notion.com/v1/data_sources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: <notion-version>' \
--data '
{
"parent": {
"database_id": "<string>",
"type": "<string>"
},
"properties": {},
"title": [
{
"text": {
"content": "<string>",
"link": {
"url": "<string>"
}
},
"annotations": {
"bold": true,
"italic": true,
"strikethrough": true,
"underline": true,
"code": true
},
"type": "<string>"
}
],
"icon": {
"file_upload": {
"id": "<string>"
},
"type": "<string>"
}
}
'import requests
url = "https://api.notion.com/v1/data_sources"
payload = {
"parent": {
"database_id": "<string>",
"type": "<string>"
},
"properties": {},
"title": [
{
"text": {
"content": "<string>",
"link": { "url": "<string>" }
},
"annotations": {
"bold": True,
"italic": True,
"strikethrough": True,
"underline": True,
"code": True
},
"type": "<string>"
}
],
"icon": {
"file_upload": { "id": "<string>" },
"type": "<string>"
}
}
headers = {
"Notion-Version": "<notion-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notion.com/v1/data_sources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'parent' => [
'database_id' => '<string>',
'type' => '<string>'
],
'properties' => [
],
'title' => [
[
'text' => [
'content' => '<string>',
'link' => [
'url' => '<string>'
]
],
'annotations' => [
'bold' => true,
'italic' => true,
'strikethrough' => true,
'underline' => true,
'code' => true
],
'type' => '<string>'
]
],
'icon' => [
'file_upload' => [
'id' => '<string>'
],
'type' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Notion-Version: <notion-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.notion.com/v1/data_sources"
payload := strings.NewReader("{\n \"parent\": {\n \"database_id\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"properties\": {},\n \"title\": [\n {\n \"text\": {\n \"content\": \"<string>\",\n \"link\": {\n \"url\": \"<string>\"\n }\n },\n \"annotations\": {\n \"bold\": true,\n \"italic\": true,\n \"strikethrough\": true,\n \"underline\": true,\n \"code\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"icon\": {\n \"file_upload\": {\n \"id\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Notion-Version", "<notion-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.notion.com/v1/data_sources")
.header("Notion-Version", "<notion-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parent\": {\n \"database_id\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"properties\": {},\n \"title\": [\n {\n \"text\": {\n \"content\": \"<string>\",\n \"link\": {\n \"url\": \"<string>\"\n }\n },\n \"annotations\": {\n \"bold\": true,\n \"italic\": true,\n \"strikethrough\": true,\n \"underline\": true,\n \"code\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"icon\": {\n \"file_upload\": {\n \"id\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notion.com/v1/data_sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Notion-Version"] = '<notion-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parent\": {\n \"database_id\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"properties\": {},\n \"title\": [\n {\n \"text\": {\n \"content\": \"<string>\",\n \"link\": {\n \"url\": \"<string>\"\n }\n },\n \"annotations\": {\n \"bold\": true,\n \"italic\": true,\n \"strikethrough\": true,\n \"underline\": true,\n \"code\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"icon\": {\n \"file_upload\": {\n \"id\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"properties": {}
}{
"object": "<unknown>",
"message": "<string>",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "unauthorized",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "restricted_resource",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "row_limit_exceeded",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "conflict_error",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "rate_limited",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "internal_server_error",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "service_unavailable",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "gateway_timeout",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "service_overload",
"status": "<unknown>",
"additional_data": {}
}Data sources
Create a data source
POST
/
v1
/
data_sources
TypeScript SDK
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.dataSources.create({
parent: {
database_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
title: [{ text: { content: "My Data Source" } }],
properties: {
Name: { title: {} },
Status: {
select: {
options: [
{ name: "To Do", color: "red" },
{ name: "Done", color: "green" }
]
}
}
}
})curl --request POST \
--url https://api.notion.com/v1/data_sources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: <notion-version>' \
--data '
{
"parent": {
"database_id": "<string>",
"type": "<string>"
},
"properties": {},
"title": [
{
"text": {
"content": "<string>",
"link": {
"url": "<string>"
}
},
"annotations": {
"bold": true,
"italic": true,
"strikethrough": true,
"underline": true,
"code": true
},
"type": "<string>"
}
],
"icon": {
"file_upload": {
"id": "<string>"
},
"type": "<string>"
}
}
'import requests
url = "https://api.notion.com/v1/data_sources"
payload = {
"parent": {
"database_id": "<string>",
"type": "<string>"
},
"properties": {},
"title": [
{
"text": {
"content": "<string>",
"link": { "url": "<string>" }
},
"annotations": {
"bold": True,
"italic": True,
"strikethrough": True,
"underline": True,
"code": True
},
"type": "<string>"
}
],
"icon": {
"file_upload": { "id": "<string>" },
"type": "<string>"
}
}
headers = {
"Notion-Version": "<notion-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notion.com/v1/data_sources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'parent' => [
'database_id' => '<string>',
'type' => '<string>'
],
'properties' => [
],
'title' => [
[
'text' => [
'content' => '<string>',
'link' => [
'url' => '<string>'
]
],
'annotations' => [
'bold' => true,
'italic' => true,
'strikethrough' => true,
'underline' => true,
'code' => true
],
'type' => '<string>'
]
],
'icon' => [
'file_upload' => [
'id' => '<string>'
],
'type' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Notion-Version: <notion-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.notion.com/v1/data_sources"
payload := strings.NewReader("{\n \"parent\": {\n \"database_id\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"properties\": {},\n \"title\": [\n {\n \"text\": {\n \"content\": \"<string>\",\n \"link\": {\n \"url\": \"<string>\"\n }\n },\n \"annotations\": {\n \"bold\": true,\n \"italic\": true,\n \"strikethrough\": true,\n \"underline\": true,\n \"code\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"icon\": {\n \"file_upload\": {\n \"id\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Notion-Version", "<notion-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.notion.com/v1/data_sources")
.header("Notion-Version", "<notion-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parent\": {\n \"database_id\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"properties\": {},\n \"title\": [\n {\n \"text\": {\n \"content\": \"<string>\",\n \"link\": {\n \"url\": \"<string>\"\n }\n },\n \"annotations\": {\n \"bold\": true,\n \"italic\": true,\n \"strikethrough\": true,\n \"underline\": true,\n \"code\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"icon\": {\n \"file_upload\": {\n \"id\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notion.com/v1/data_sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Notion-Version"] = '<notion-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parent\": {\n \"database_id\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"properties\": {},\n \"title\": [\n {\n \"text\": {\n \"content\": \"<string>\",\n \"link\": {\n \"url\": \"<string>\"\n }\n },\n \"annotations\": {\n \"bold\": true,\n \"italic\": true,\n \"strikethrough\": true,\n \"underline\": true,\n \"code\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"icon\": {\n \"file_upload\": {\n \"id\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"properties": {}
}{
"object": "<unknown>",
"message": "<string>",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "unauthorized",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "restricted_resource",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "row_limit_exceeded",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "conflict_error",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "rate_limited",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "internal_server_error",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "service_unavailable",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "gateway_timeout",
"status": "<unknown>",
"additional_data": {}
}{
"object": "<unknown>",
"message": "<string>",
"code": "service_overload",
"status": "<unknown>",
"additional_data": {}
}Use this API to add an additional data source to an existing database. The
properties follow the same structure as the initial schema passed to initial_data_source[properties] in the Create a database API, but can be managed independently of the properties of any sibling data sources.
A standard “table” view is created alongside the new data source. To customize database views, use the Notion app. Managing views is not currently supported in the API.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The API version to use for this request. The latest version is 2026-03-11.
Available options:
2026-03-11 Body
application/json
An object specifying the parent of the new data source to be created.
Show child attributes
Show child attributes
Property schema of data source.
Show child attributes
Show child attributes
Title of data source as it appears in Notion.
Maximum array length:
100- Text
- Mention
- Equation
Show child attributes
Show child attributes
Page icon.
- File Upload
- Emoji
- External
- Custom Emoji
- Icon
Show child attributes
Show child attributes
⌘I