Go SDK
The official Go SDK wraps the CoinMarketCap Pro API with typed request and response structs, automatic retries, and endpoints grouped by category.
- Module:
github.com/OpenCMC/coinmarketcap-api-go/v5 - GitHub: OpenCMC/coinmarketcap-api-go
- Package name:
coinmarketcap - Requires: Go 1.24+
Get started
-
Install the module
Code -
Create a client
Set your API key from the Developer Portal. For keyless endpoints, use
WithEnvironment(coinmarketcap.EnvironmentPublic).Code -
Call an endpoint
Endpoints are grouped by category on the client. Optional parameters are pointers;
coinmarketcap.String,Int,Float64,BoolandPtrcreate them:Code -
Handle errors
HTTP errors come back as typed errors. Use
errors.Asto inspect them:Code
Public (keyless) mode
Code
See the Keyless Public API for available endpoints without a key.
Configuration
Code
Requests are retried on 408, 409, 429 and 5xx responses, network errors and timeouts, with exponential backoff that honors Retry-After. The client is safe for concurrent use; create one and reuse it.
Next steps
- Get Started with an API Key if you have not set up authentication yet
- Choose an endpoint to find the right API family
- Every endpoint page in the API reference has a Go SDK sample
- Full README and examples on GitHub