Python SDK
Install and start using the Python SDK.
Intro
The APIMatic Portal Artifacts API SDK provides access to the APIMatic Portal Artifacts API REST APIs.
Generate the artifacts an APIMatic API Portal needs (SDKs, code samples, getting started guides and, optionally, a context plugin) from a Portal Build Input, asynchronously.
The generation flow is:
- Upload your build directory as a zip file using Generate Portal Artifacts Async. You get back an
idand links to check the status and download the artifacts. - Poll Get Portal Artifacts Generation Status until generation completes, or pass the
X-APIMatic-CallbackUrlheader in step 1 to be notified instead. - Download the generated artifacts using Download Generated Portal Artifacts.
Installation
Add the SDK to your project from its folder, with whichever package manager your project uses. Give each tool a path containing a slash, such as ../api-matic-portal-artifacts-api — a bare folder name is looked up on PyPI instead, and resolves to whatever project holds that name there:
pip install <path-to-sdk>uv add <path-to-sdk>poetry add <path-to-sdk>Quick Start
Synchronous client
Construct ApiMaticPortalArtifactsApiClient with keyword arguments, and call close() when you are done. Every argument is optional.
from api_matic_portal_artifacts_api import ApiMaticPortalArtifactsApiClient
client = ApiMaticPortalArtifactsApiClient(authorization="YOUR_API_KEY")
client.close()Alternatively, scope it — with ApiMaticPortalArtifactsApiClient(...) as client: closes the pool on exit.
Asynchronous client
AsyncApiMaticPortalArtifactsApiClient mirrors ApiMaticPortalArtifactsApiClient with identical method names, and every endpoint method is a coroutine. It takes the same arguments, with some differences — for example, the transport argument is custom_async_http_client.
from asyncio import run
from api_matic_portal_artifacts_api import AsyncApiMaticPortalArtifactsApiClient
async def main() -> None:
client = AsyncApiMaticPortalArtifactsApiClient(authorization="YOUR_API_KEY")
await client.aclose()
run(main())Alternatively, scope it — async with AsyncApiMaticPortalArtifactsApiClient(...) as client: closes the pool on exit.