SDKs
Official TypeScript, Python, and Go libraries for the Pylon API
Pylon has official SDKs for TypeScript, Python, and Go. They cover every endpoint in the API Reference, with types for every request and response, and handle authentication, pagination, and retries for you.
Install
npm install --save-exact @usepylon/sdk@0.1.0-beta.2Requires Node.js 18 or later. The package ships both ES module and CommonJS builds.
pip install "usepylon==0.1.0b2"Requires Python 3.9 or later. An AsyncPylon client is included for asyncio.
go get github.com/pylon-labs/pylon-go@v0.1.0-beta.2Requires Go 1.22 or later.
Upgrade
These releases add user invitations, customer portal settings, filters on related objects, structured filter_errors for invalid filters, and each issue thread's delivery mode.
For TypeScript and Go, run the matching pinned command in Install in your existing project. For Python, run:
pip install --upgrade "usepylon==0.1.0b2"SDK and CLI versions are independent. Updating an SDK does not update your installed CLI.
Make your first request
Create an API token as described in Authentication, then call /me to confirm it works:
Choose your region
The client uses the US region unless you set it. If your Pylon tenant is hosted in the EU, select the EU region. See API regions for how to tell which one you're on.
How methods map to endpoints
Methods are named after the endpoint path: the resource, then the action. Nested resources become nested clients.
GET /issues/{id}
client.issues.get({ id })
client.issues.get(id)
client.Issues.Get(ctx, &pylon.IssuesGetRequest{ID: id})
POST /issues
client.issues.create({ ... })
client.issues.create(...)
client.Issues.Create(ctx, &pylon.IssuesCreateRequest{...})
POST /issues/search
client.issues.search({ filter })
client.issues.search(filter=...)
client.Issues.Search(ctx, &pylon.IssuesSearchRequest{Filter: ...})
GET /knowledge-bases/{id}/articles
client.knowledgeBases.articles.list({ knowledge_base_id })
client.knowledge_bases.articles.list(knowledge_base_id)
client.KnowledgeBases.Articles.List(ctx, &knowledgebases.KnowledgeBasesArticlesListRequest{KnowledgeBaseID: id})
In TypeScript, each method takes one object holding the path parameters and request fields under their API names. In Python, path parameters are positional and fields are keyword arguments. In Go, each method takes a context.Context and a request struct; request types for nested resources live in that resource's package, such as knowledgebases.
Responses keep the API's shape, so the record is under data (GetData() in Go).
Pagination
List and search methods return a pager that fetches the next page as you iterate:
To work a page at a time, use page.hasNextPage() and page.getNextPage(). getNextPage() loads the next page into the same object.
To work a page at a time, iterate over client.accounts.list(limit=100).iter_pages().
To work a page at a time, use page.Results and page.GetNextPage(ctx).
See API conventions for how cursors and limits work.
Handle errors
A request that fails raises an error carrying the HTTP status code and the error response body. Each status has its own type, such as NotFoundError, UnauthorizedError, and TooManyRequestsError.
Retries and timeouts
Requests that are rate limited (429) or hit a server error (5xx) are retried with backoff, waiting as long as the Retry-After header asks. Requests that create something aren't retried, so a retry can't create a duplicate. See Rate limits for the limits themselves.
In TypeScript and Python, requests time out after 60 seconds and are retried up to 2 times. In Go, set a timeout with the context you pass in. You can change these for the whole client or for one request:
Report a problem
Open an issue on the SDK's GitHub repository: pylon-typescript, pylon-python, or pylon-go.
Last updated
Was this helpful?

