curl --location --request GET https://api.writer.com/v1/graphs \
--header "Authorization: Bearer <token>"import os
from writerai import Writer
client = Writer(
# This is the default and can be omitted
api_key=os.environ.get("WRITER_API_KEY"),
)
page = client.graphs.list()
page = page.data[0]
print(page.id)import Writer from 'writer-sdk';
const client = new Writer({
apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
});
async function main() {
// Automatically fetches more pages as needed.
for await (const graph of client.graphs.list()) {
console.log(graph.id);
}
}
main();{
"data": [
{
"id": "50daa3d0-e7d9-44a4-be42-b53e2379ebf7",
"created_at": "2024-07-10T15:03:48.785843Z",
"name": "Example Knowledge Graph",
"description": "Example description",
"file_status": {
"in_progress": 0,
"completed": 0,
"failed": 0,
"total": 11
},
"type": "manual",
"urls": null,
"team_ids": []
},
{
"id": "e7392337-1c4e-4bc9-aaf5-b719bf1e938a",
"created_at": "2024-07-10T15:03:39.881370Z",
"name": "Another example Knowledge Graph",
"description": "Another example description",
"file_status": {
"in_progress": 0,
"completed": 0,
"failed": 0,
"total": 0
},
"type": "web",
"urls": [
{
"url": "https://docs.example.com",
"status": {
"status": "success",
"error_type": null
},
"type": "single_page"
}
],
"team_ids": []
}
],
"first_id": "50daa3d0-e7d9-44a4-be42-b53e2379ebf7",
"last_id": "e7392337-1c4e-4bc9-aaf5-b719bf1e938a",
"has_more": true
}List graphs
Retrieve a list of Knowledge Graphs.
By default, the response contains only org-wide Knowledge Graphs. To include Knowledge Graphs that are deployed to specific teams, pass one or more team IDs in the team_ids query parameter. Requests authenticated with a team-scoped API key always return only that key’s team; passing a different value in team_ids is rejected.
curl --location --request GET https://api.writer.com/v1/graphs \
--header "Authorization: Bearer <token>"import os
from writerai import Writer
client = Writer(
# This is the default and can be omitted
api_key=os.environ.get("WRITER_API_KEY"),
)
page = client.graphs.list()
page = page.data[0]
print(page.id)import Writer from 'writer-sdk';
const client = new Writer({
apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
});
async function main() {
// Automatically fetches more pages as needed.
for await (const graph of client.graphs.list()) {
console.log(graph.id);
}
}
main();{
"data": [
{
"id": "50daa3d0-e7d9-44a4-be42-b53e2379ebf7",
"created_at": "2024-07-10T15:03:48.785843Z",
"name": "Example Knowledge Graph",
"description": "Example description",
"file_status": {
"in_progress": 0,
"completed": 0,
"failed": 0,
"total": 11
},
"type": "manual",
"urls": null,
"team_ids": []
},
{
"id": "e7392337-1c4e-4bc9-aaf5-b719bf1e938a",
"created_at": "2024-07-10T15:03:39.881370Z",
"name": "Another example Knowledge Graph",
"description": "Another example description",
"file_status": {
"in_progress": 0,
"completed": 0,
"failed": 0,
"total": 0
},
"type": "web",
"urls": [
{
"url": "https://docs.example.com",
"status": {
"status": "success",
"error_type": null
},
"type": "single_page"
}
],
"team_ids": []
}
],
"first_id": "50daa3d0-e7d9-44a4-be42-b53e2379ebf7",
"last_id": "e7392337-1c4e-4bc9-aaf5-b719bf1e938a",
"has_more": true
}- With an org-scoped API key, control team scope from the request body: pass
team_idson create or update, or filter list with theteam_idsquery parameter. Omitteam_idson list to see only org-wide Knowledge Graphs. - With a team-scoped API key, every request is automatically restricted to the key’s team. Create assigns to that team; list and retrieve return only that team’s Knowledge Graphs; body
team_idsis not accepted.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your Writer API key.
Query Parameters
Specifies the order of the results. Valid values are asc for ascending and desc for descending.
asc, desc The ID of the first object in the previous page. This parameter instructs the API to return the previous page of results.
The ID of the last object in the previous page. This parameter instructs the API to return the next page of results.
Specifies the maximum number of objects returned in a page. The default value is 50. The minimum value is 1, and the maximum value is 100.
Filter results to Knowledge Graphs deployed to any of the specified teams. Repeat the query parameter to pass multiple IDs (for example, ?team_ids=42&team_ids=43). Omitting this parameter returns only org-wide Knowledge Graphs; Knowledge Graphs deployed to specific teams are excluded unless the caller opts them in via team_ids.
Response
Show child attributes
Show child attributes
Indicates if there are more Knowledge Graphs available beyond the current page.
The ID of the first Knowledge Graph in the current response.
The ID of the last Knowledge Graph in the current response.
Was this page helpful?