Publish Your SDKs
Publishing SDKs is critical to the success of your API. Package managers are important platforms for developers to discover and use third-party services.
Developers are familiar with using package managers for managing their external dependencies, and they will expect to be able to do the same with your API.
If you don't publish your SDKs, it's unlikely that developers will find your API, or if they do, they are unlikely to manually download the SDK and manage it themselves.
Once you've created an SDK for your API, you can set up publishing it with a few additional inputs to the SDK configuration. The exact format will be different depending on the language you're using, but the general idea is the same:
Check the publishing box (except for Go), and then provide a package name and credentials for the package manager you're publishing to.
In this article, we will walk you through creating the necessary credentials for the different languages and package managers and the conventions you should follow.
Speakeasy SDK creation supports publishing SDKs to the following package managers:
To enable Speakeasy to manage publishing, you need to create tokens or provide credentials for each package manager you publish to. The tokens will be used to authenticate Speakeasy to publish on your behalf. Follow the links below to learn how to create the tokens for each package manager:
|Package Manager||Credential Creation||Notes|
|GitHub (Go)||Repo visibility (opens in a new tab)||If your repo is private, you need to add the Speakeasy app (opens in a new tab).|
|PyPi (Python)||API tokens (opens in a new tab)|
|NPM (JS/TS)||Access tokens (opens in a new tab)||Be sure to create an access token of type |
|Maven (Java)||See our docs on setting this up (opens in a new tab)||Publishing Java packages requires verification of domain ownership and signed releases.|
|Packagist (PHP)||See publishing packages (opens in a new tab)||To publish a PHP SDK, it must be in a single repo (monorepo not permitted).|
|Nuget (C#)||API key (opens in a new tab)|
Choose a name that will uniquely identify your package in the package manager ecosystem, so check to see if your preferred name is available first.
The name you give your package should make sense for your API. For example, if your business name is "pet-corp" and you're creating a package for your ecommerce API, you might call it
petcorp-ecommerce. Make sure that the name follows the conventions of the package manager, summarized below:
|Language||Package Manager||Example Package||Naming Conventions|
|JS/TS||npm||@npm-org/package-name||Lower case, hyphen separated|
|Python||PyPI||package_name||Lower case, underscore separated|
|Go||GitHub||github.com/org/repo-name||Lower case, hyphen separated|
|PHP||Packagist||org/package-name||Lower case, hyphen separated|
PyPI and Maven both scope packages globally, so you should choose a unique name for your package.
Click Save and regenerate and every time there's an update to your managed SDKs, your SDKs will also be updated on the package managers you've configured. Your SDKs will always be up to date, no matter where they are hosted.
To verify that the publishing is running correctly, click the View in GitHub button on the latest run, and you'll see a publishing step execute in the workflow: