You need an API key to access the Writer API. Get an API key by following the steps in the API quickstart.We recommend setting the API key as an environment variable in a
.env file with the name WRITER_API_KEY.Knowledge Graphs can be deployed org-wide (accessible to every team in the organization) or deployed to specific teams. Both are accessible via the API and SDK.
- 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.
Overview
Adding URLs to your Knowledge Graph enables you to:- Automatically extract content from websites
- Index web pages for Knowledge Graph queries
- Process single pages or entire sub-pages
- Monitor the status of URL processing
- Exclude specific URLs from processing
Add URLs to a Knowledge Graph
To add web connector URLs to your Knowledge Graph, use the PUT endpoint to update the graph with the URLs you want to process. This endpoint allows you to add, update, or remove URLs from your Knowledge Graph.Request structure
When updating a Knowledge Graph with URLs, you need to provide aurls array in your request body. Each URL object has the following parameters:
Response structure
After you update the Knowledge Graph, you see the status of each URL in thestatus object. The status object has the following parameters:
Possible error types
If URL processing fails, you may see these error types:invalid_url: The URL format is not validnot_searchable: The content cannot be accessed or processednot_found: The URL returns a 404 errorpaywall_or_login_page: The content requires authenticationunexpected_error: An unspecified error occurred
Usage examples
The following examples show how to add a web connector URL to a Knowledge Graph and monitor its processing status.Add a web connector URL
This example adds a web connector URL to a Knowledge Graph. It first retrieves the Knowledge Graph to see the current URLs and then adds a new URL to the Knowledge Graph. Note that this operation replaces the entire list of URLs attached to the Knowledge Graph, which is why it is important to retrieve the existing list of URLs first.Delete all URLs from a Knowledge Graph
To delete all URLs from a Knowledge Graph, you can send a request with an emptyurls array.