-
Notifications
You must be signed in to change notification settings - Fork 6
[Feature Request] REST API access to Perplexity Web Threads for programmatic thread export, listing, and management #329
Description
🚀 Feature Request
I'm pretty sure I'm not the only one to make this request, but I would like to put this out there so more people can see it. I hope it's not spamming the requested feature list.
It would be great to see official support for Perplexity REST API to access the user threads and spaces like on the web UI version. This way, users (or third-party devs) can programmatically access their knowledge base and massively export them into different types of documents. With this, we could expect third-party interfaces, apps, merging generated data with other LLM chatbots like ChatGPT, and flawless integration with other note taking apps like Notion or Obsidian.
Just imagine how you could make a quick query to Perplexity from your phone and continuously integrate the artifact to Obsidian to integrate them into your existing notes (or even better, use Perplexity spaces and pages on other note apps). This would allow me to make a personal wiki-on-the-go for various topics and niche technical questions without having to manually navigate and export individual threads!
🔍 Problem Statement
As many are aware, Perplexity API only allows data generations via models and access to their crawlers, which is cool and useful for (mainly) stateless public-facing apps. But I've been using Perplexity as a personal knowledge base that has been increasing rapidly than the web app's UX can follow. I've been using the app's export feature a lot (thank goodness for the Markdown export), but when I have to work with too many unorganized threads and spaces, this easily becomes out of hand for many users.
At least to my knowledge, there are no official REST API documentation or a Swagger UI for interacting with Perplexity threads, but I can verifiably check that the web app is already using undocumented API requests for various web app operations. Reverse-engineering this to make a crude API documentation would be too challenging.
If there is an official REST API to interact with Perplexity threads, I think this can solve a lot of problems and open up the Perplexity ecosystem.
💡 Proposed Solution
Describe how this feature should work. If possible, provide an example or use case demonstrating how it would be used.
Based on the API requests the web app was making, I can easily see the API being designed and available for third-party devs.
For example, when a user exports a thread to markdown, the UI makes the following POST request:
https://www.perplexity.ai/rest/thread/export?version=2.18&source=default
with the following JSON body:
{
"thread_uuid": "i-use-arch-btw-ee59f19c17ce",
"format": "md"
}And the response looks like the following:
{"file_content_64":"<base64 encoded thread content in markdown>","filename":"<file name>.md"}I think this is already a great API that people can use. I'm not sure if all UI interactions have an API like this, but making something like this available to the developers by using the same bearer token to authenticate like the Sonar model access would be amazing.
📌 API Impact
- Which API component is affected? It wouldn't 'affect' an API component per se. Since the internal REST APIs are already implemented and used internally by the web UI, the main changes would be allowing users to access the web requests via the generated API keys instead of logging in using social credentials.
- Is this related to a specific model? Not limited to certain models.
- Would this require new API parameters or changes to existing ones? I don't think any API would be affected, outside of making existing ones available to users via the generated API key.
Having said that, I can see the argument that allowing this could create resource constraints due to increased bot traffic to the web app, and would perhaps need work with the load balancer, or potential security concerns for accessing user prompts (though I rarely saw any LLM chatbots with e2e encryption). But I can't see how allowing people to systematically export threads of already generated text be more resource-intensive than programmatically re-running an AI model until it gets the response they want like a gatcha-addict on steroids.
🔄 Alternatives Considered
Have you explored any workarounds? If so, what were they, and why are they insufficient?
If I try to use the existing REST API directly, this will cause various authentication issues, making it very challenging without completely reverse engineering the session/web token management methods.
Alternatively, I can use browser-based scraping libraries like Playwrite, Crawl4ai, or Puppeteer to automatically parse generated threads and perform various operations. This seems to work better, but it's very unreliable and can be a pain to debug when the web app decides to update in random times (tbf this is also a pain on the normal web UI when I'm dealing with a very long thread and decide to look at a different tab for a second).
📎 Additional Context
This feature request is related to #242
As noted above, my main use case for this is to create a plugin for integrating the Perplexity UI with Obsidian like the discussion here. I'm not trying to make a model integration.
📧 For direct inquiries, please reach out to [email protected]