Skip to Content

Third-Party API

This document explains all publicly available API endpoints. All requests start with /tp.

All endpoints on this page must include the following request header

HeaderValue
API-KEYyour api key

You can add an API key by clicking Revornix (avatar in the lower-left corner) -> Account -> APIKey Management.


/tp/file/upload

Upload a file

Parameters

ParameterTypeRequiredDescription
fileFileYesFile
file_pathstringNoFile path
content_typestringNoFile type

Example Code

import httpx client = httpx.Client() headers = { "API-KEY": "your api key" } files = { "file": ("example.md", open("example.md", "rb"), "text/markdown") } data = { "file_path": "/files/example.md", "content_type": "text/markdown" } response = client.post( url="http://localhost:8001/tp/section/create", headers=headers, files=files, data=data )

/tp/section/create

Create a section

Parameters

ParameterTypeRequiredDescription
titlestringYesSection name
descriptionstringYesSection description
publicboolYesWhether it is public
coverstringNoCover image
labelsint[]YesLabel group

Example Code

import httpx client = httpx.Client() headers = { "API-KEY": "your api key" } response = client.post( url="http://localhost:8001/tp/section/create", headers=headers, json={ "title": "test title", "description": "test description", "public": true, "cover": "test/test.png", "labels": [1, 2], } )

/tp/section/label/create

Create a section label

Parameters

ParameterTypeRequiredDescription
namestringYesLabel name

Example Code

import httpx client = httpx.Client() headers = { "API-KEY": "your api key" } response = client.post( url="http://localhost:8001/tp/section/label/create", headers=headers, json={ "name": "test" } )

/tp/section/mine/all

Retrieve all of my sections


/tp/document/label/list

Retrieve all document labels


/tp/document/label/create

Create a document label

Parameters

ParameterTypeRequiredDescription
namestringYesLabel name

Example Code

import httpx client = httpx.Client() headers = { "API-KEY": "your api key" } response = client.post( url="http://localhost:8001/tp/document/label/create", headers=headers, json={ "name": "test" } )

/tp/document/create

Create a document

Parameters

ParameterTypeRequiredDescription
categoryintYesDocument type: 0 for file documents, 1 for link documents, 2 for quick note documents
from_platstringYesSource platform; fill in according to your scenario. We recommend using api.
sectionsint[]YesSections to publish to
auto_summarybooleanNoWhether to generate a summary automatically
labelsint[]YesLabel group
urlstringConditionalLink; required for link documents and only valid for link documents
contentstringConditionalContent; required for quick note documents and only valid for quick note documents
file_namestringConditionalFile path (this is the file_path you used when uploading the file); required for file documents and only valid for file documents. You need to upload the file first.

Example Code

This example demonstrates a link document. Adjust it for other document types.

import httpx client = httpx.Client() headers = { "API-KEY": "your api key" } response = client.post( url="http://localhost:8001/tp/document/create", headers=headers, json={ "category": 1, "from_plat": "api", "sections": [], "auto_summary": True, "labels": [], "url": "https://baidu.com" } )
Last updated on