Create source
curl --request POST \
--url https://api.exec.com/rest/v1/knowledge-hub/sources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "url",
"title": "Competitor pricing page",
"url": "https://example.com/pricing",
"folder_ids": [
"f1a2b3c4d5e6"
]
}
'import requests
url = "https://api.exec.com/rest/v1/knowledge-hub/sources"
payload = {
"type": "url",
"title": "Competitor pricing page",
"url": "https://example.com/pricing",
"folder_ids": ["f1a2b3c4d5e6"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'url',
title: 'Competitor pricing page',
url: 'https://example.com/pricing',
folder_ids: ['f1a2b3c4d5e6']
})
};
fetch('https://api.exec.com/rest/v1/knowledge-hub/sources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exec.com/rest/v1/knowledge-hub/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([
'type' => 'url',
'title' => 'Competitor pricing page',
'url' => 'https://example.com/pricing',
'folder_ids' => [
'f1a2b3c4d5e6'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.exec.com/rest/v1/knowledge-hub/sources"
payload := strings.NewReader("{\n \"type\": \"url\",\n \"title\": \"Competitor pricing page\",\n \"url\": \"https://example.com/pricing\",\n \"folder_ids\": [\n \"f1a2b3c4d5e6\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.exec.com/rest/v1/knowledge-hub/sources")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"url\",\n \"title\": \"Competitor pricing page\",\n \"url\": \"https://example.com/pricing\",\n \"folder_ids\": [\n \"f1a2b3c4d5e6\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exec.com/rest/v1/knowledge-hub/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"url\",\n \"title\": \"Competitor pricing page\",\n \"url\": \"https://example.com/pricing\",\n \"folder_ids\": [\n \"f1a2b3c4d5e6\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"title": "<string>",
"source_type": "upload",
"status": "pending",
"content_format": "markdown",
"token_count": 123,
"has_images": true,
"external_url": "<string>",
"summary": "<string>",
"cover": "<string>",
"folders": [
{
"id": "<string>",
"name": "<string>",
"emoji": "<string>"
}
],
"created_by": {
"id": "<string>",
"email": "[email protected]",
"first_name": "<string>",
"last_name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"processed_at": "2023-11-07T05:31:56Z",
"content": "<string>"
}{
"id": "<string>",
"title": "<string>",
"source_type": "upload",
"status": "pending",
"content_format": "markdown",
"token_count": 123,
"has_images": true,
"external_url": "<string>",
"summary": "<string>",
"cover": "<string>",
"folders": [
{
"id": "<string>",
"name": "<string>",
"emoji": "<string>"
}
],
"created_by": {
"id": "<string>",
"email": "[email protected]",
"first_name": "<string>",
"last_name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"processed_at": "2023-11-07T05:31:56Z",
"content": "<string>"
}{
"error": {
"type": "invalid_request",
"code": "invalid_pagination",
"message": "Invalid pagination parameters"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}Knowledge Hub
Create source
Creates a Knowledge Hub source from a URL. Text extraction runs
asynchronously, so the source is returned with status: pending or
processing; poll the detail endpoint until status is ready.
URL sources are de-duplicated within the workspace: if the URL already
exists, the existing source is returned with status 200 instead of
201.
File upload via the REST API is not yet supported — use URL ingest.
POST
/
knowledge-hub
/
sources
Create source
curl --request POST \
--url https://api.exec.com/rest/v1/knowledge-hub/sources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "url",
"title": "Competitor pricing page",
"url": "https://example.com/pricing",
"folder_ids": [
"f1a2b3c4d5e6"
]
}
'import requests
url = "https://api.exec.com/rest/v1/knowledge-hub/sources"
payload = {
"type": "url",
"title": "Competitor pricing page",
"url": "https://example.com/pricing",
"folder_ids": ["f1a2b3c4d5e6"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'url',
title: 'Competitor pricing page',
url: 'https://example.com/pricing',
folder_ids: ['f1a2b3c4d5e6']
})
};
fetch('https://api.exec.com/rest/v1/knowledge-hub/sources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exec.com/rest/v1/knowledge-hub/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([
'type' => 'url',
'title' => 'Competitor pricing page',
'url' => 'https://example.com/pricing',
'folder_ids' => [
'f1a2b3c4d5e6'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.exec.com/rest/v1/knowledge-hub/sources"
payload := strings.NewReader("{\n \"type\": \"url\",\n \"title\": \"Competitor pricing page\",\n \"url\": \"https://example.com/pricing\",\n \"folder_ids\": [\n \"f1a2b3c4d5e6\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.exec.com/rest/v1/knowledge-hub/sources")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"url\",\n \"title\": \"Competitor pricing page\",\n \"url\": \"https://example.com/pricing\",\n \"folder_ids\": [\n \"f1a2b3c4d5e6\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exec.com/rest/v1/knowledge-hub/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"url\",\n \"title\": \"Competitor pricing page\",\n \"url\": \"https://example.com/pricing\",\n \"folder_ids\": [\n \"f1a2b3c4d5e6\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"title": "<string>",
"source_type": "upload",
"status": "pending",
"content_format": "markdown",
"token_count": 123,
"has_images": true,
"external_url": "<string>",
"summary": "<string>",
"cover": "<string>",
"folders": [
{
"id": "<string>",
"name": "<string>",
"emoji": "<string>"
}
],
"created_by": {
"id": "<string>",
"email": "[email protected]",
"first_name": "<string>",
"last_name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"processed_at": "2023-11-07T05:31:56Z",
"content": "<string>"
}{
"id": "<string>",
"title": "<string>",
"source_type": "upload",
"status": "pending",
"content_format": "markdown",
"token_count": 123,
"has_images": true,
"external_url": "<string>",
"summary": "<string>",
"cover": "<string>",
"folders": [
{
"id": "<string>",
"name": "<string>",
"emoji": "<string>"
}
],
"created_by": {
"id": "<string>",
"email": "[email protected]",
"first_name": "<string>",
"last_name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"processed_at": "2023-11-07T05:31:56Z",
"content": "<string>"
}{
"error": {
"type": "invalid_request",
"code": "invalid_pagination",
"message": "Invalid pagination parameters"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}Authorizations
Body
application/json
Response
An existing source with the same URL was returned (de-duplicated)
A Knowledge Hub source — an uploaded file or ingested URL whose text is extracted and indexed.