Skip to main content
The official Swift client library for the CoinPaprika API provides convenient, static access to cryptocurrency market data.

Installation

Swift Package Manager (SPM)

Add the following package dependency to your Package.swift file or via Xcode:

CocoaPods

Add the following line to your Podfile and run pod install:

Quick Start

First, import the library:
Then, you can call any API endpoint via the static Coinpaprika.API object. All requests are asynchronous and return a Result type in a closure.

Authenticating with a paid plan

Paid plans (Starter / Pro / Business / Ultimate / Enterprise) live on a separate hostname, https://api-pro.coinpaprika.com/v1/, and require an API key in the Authorization header. Send the bare key, because a Bearer prefix is rejected by the WAF. The high-level Coinpaprika.API static methods don’t currently accept a key. To call paid endpoints, drop down to the CoinpaprikaNetworking Request<Model> constructor with .bearer(token:) and point it at the Pro base URL. The package exposes CoinpaprikaNetworking as a separate library product, so add it to your target’s dependencies alongside Coinpaprika.
For free-tier endpoints that don’t need a key (most of Coinpaprika.API), keep using the high-level static API against the default base URL.

Common Use Cases

Ticker Data for a Specific Coin

Coin Details

Historical Ticker Data

Historical endpoints require a paid plan. The high-level Coinpaprika.API.historicalTicks(...) shape is shown below for the request structure; to actually authenticate, build a Request<Tick> against the Pro base URL using the .bearer(token:) pattern from “Authenticating with a paid plan”.

Error Handling

The Result object in the completion handler provides a detailed RequestError case for failures.

Async/Await Support (iOS 13+ / macOS 10.15+)

The SDK supports modern concurrency with async/await.

Available Methods

Global Data

  • global() - Get global market overview.

Coins

Tickers

Exchanges

People & Tags

Search & Tools

FAQs

The high-level Coinpaprika.API static methods don’t currently accept a key. Use CoinpaprikaNetworking’s Request<Model> constructor with .bearer(token:) and the https://api-pro.coinpaprika.com/v1/ base URL. See the “Authenticating with a paid plan” section above.
Use the Coverage Checker to obtain canonical IDs (e.g., btc-bitcoin).
Historical endpoints require a paid plan. Build a Request<Model> against the Pro base URL with .bearer(token:) auth (see the “Authenticating with a paid plan” section), pointing at tickers//historical or coins//ohlcv/historical with start/end/quote parameters.

Requirements

  • iOS 10.0+ / macOS 10.12+ / watchOS 3.0+ / tvOS 10.0+
  • Swift 4.2+

License

This library is available under the MIT license. See the LICENSE file for more info.