Remove a project document
curl --request DELETE \
--url https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}', 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.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"source_id": "9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e",
"project_id": "b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c",
"status": "removed",
"records_removed": 12
}
Documents
Remove a project document
Remove a document from a project. Every memory made from it is deleted too, so nothing from it is used again.
DELETE
/
api
/
v1
/
projects
/
{project_id}
/
sources
/
{source_id}
Remove a project document
curl --request DELETE \
--url https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}', 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.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tensorpro.ai/api/v1/projects/{project_id}/sources/{source_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"source_id": "9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e",
"project_id": "b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c",
"status": "removed",
"records_removed": 12
}
Use this endpoint to take a document out of a project. Everything EDN saved from the document is deleted with it, so it’s never used again.
See Error handling.
What EDN does
- Removes the document from the project.
- Deletes every memory made from it.
- Leaves the project’s other documents and your general memory untouched.
Required headers
| Header | Value | Description |
|---|---|---|
Authorization | Bearer YOUR_API_KEY | Your EDN API key. Create keys in the Console. See Authentication |
Request
| Parameter | Type | Description |
|---|---|---|
project_id | string | Identifier for the project |
source_id | string | Identifier for the document to remove, from List project documents |
curl -X DELETE "https://api.tensorpro.ai/api/v1/projects/b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c/sources/9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e" \
-H "Authorization: Bearer $EDN_API_KEY"
import os
import requests
resp = requests.delete(
"https://api.tensorpro.ai/api/v1/projects/b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c/sources/9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e",
headers={"Authorization": f"Bearer {os.environ['EDN_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
const resp = await fetch("https://api.tensorpro.ai/api/v1/projects/b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c/sources/9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.EDN_API_KEY}`,
},
});
console.log(await resp.json());
Response
200 OK
{
"source_id": "9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e",
"project_id": "b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c",
"status": "removed",
"records_removed": 12
}
| Field | Type | Description |
|---|---|---|
source_id | string | The removed document |
project_id | string | The project it was removed from |
status | string | Always removed |
records_removed | integer | How many memories were deleted with it |
Errors
| Status | Code | When |
|---|---|---|
401 | UNAUTHORIZED | The API key is missing, invalid or revoked |
404 | NOT_FOUND | The project or document doesn’t exist or isn’t yours |
429 | RATE_LIMITED | Per-minute limit reached. Retry after Retry-After seconds |
500 | INTERNAL_ERROR | Something failed on EDN’s side. Retry later |
{
"source_id": "9a1c3e5f-7b2d-4f6a-8c0e-3b5d7f9a1c2e",
"project_id": "b4c8e2f6-1a3d-4e5f-9b7c-2d6e8f0a1b3c",
"status": "removed",
"records_removed": 12
}
