Client Libraries

finlight has official client libraries for eight languages. Each library has a new major version that speaks API v3. It covers search, lookups, live streams and webhook verification, so you do not have to write the HTTP and WebSocket code yourself.

LanguagePackageVersionRequiresStreamingRepository
TypeScript / JavaScriptfinlight-client (npm), @finlight/client (JSR)4.0.0Node.js 20+Yesjubeiargh/finlight-client
Pythonfinlight-client (PyPI)3.0.0Python 3.10+Yesjubeiargh/finlight-client-py
Gogithub.com/callbk/finlight-client-go/v2v2.0.0Go 1.24+Yescallbk/finlight-client-go
.NET / C#Finlight.Client (NuGet)2.0.0.NET 8+Yescallbk/finlight-client-dotnet
Java / Kotlinme.finlight:finlight-client (Maven Central)1.0.0Java 17+Yescallbk/finlight-client-java
PHPfinlight/client (Packagist)2.0.0PHP 8.2+ (64-bit), a PSR-18 HTTP clientNo (message helpers only)callbk/finlight-client-php
Rubyfinlight-client (RubyGems)1.0.0Ruby 3.2+Yescallbk/finlight-client-ruby
Rustfinlight-client (crates.io)0.2.0Rust 1.85+, tokioYescallbk/finlight-client-rust

Every library is open source under the MIT license. Each README lists all requirements and the full API.


Install

Every client takes your API key in its constructor and sends it as the X-API-KEY header. Get a key in the finlight Dashboard.

Install

# cURL needs no client library. Every request on these pages
# has a cURL example.
curl --version

If you build with Maven rather than Gradle, use the same coordinate:

<dependency>
  <groupId>me.finlight</groupId>
  <artifactId>finlight-client</artifactId>
  <version>1.0.0</version>
</dependency>

The PHP client finds any PSR-18 HTTP client. Guzzle is used automatically when it is installed, which is why the command above adds it.


What every client gives you

All eight libraries follow the same rules, so the concepts do not change when you switch languages.

  • Search. search returns one page. searchAll (Python, Ruby and Rust: search_all; Go: SearchAll; .NET: SearchAllAsync) walks the cursor for you. It sends the same request body on every page, so the cursor stays valid. It stops after a set number of pages, because every page costs a credit. See Pagination.
  • Lookups. Get an article by id or by link, search and resolve companies, and list sources. The SDKs keep no cache of company records. To save credits, keep the records yourself for a day. You can pass a stored ETag as ifNoneMatch. An unchanged record then comes back as "not modified" (null). That 304 is a request and costs 1 credit, like every request. See Companies and Sources.
  • Streams. Enriched and raw WebSocket streams in the usual style of each language (async iterators, Go iterators, IAsyncEnumerable, Rust Streams). The client pings every 25 seconds, reconnects when no pong comes for 60 seconds, opens a fresh connection before the 2 hour limit, subscribes again after every reconnect and drops duplicates. See WebSocket.
  • Webhook verification. One call checks the signature on the raw body and the timestamp (300 seconds tolerance), then reads the v3 envelope. A correctly signed v2 body is reported as WrongPayloadVersion, so you can switch a webhook without losing deliveries. See Signature verification.
  • Typed errors. API errors carry status, code, detail, requestId and the field errors. Each known error code has its own error type or kind, and codes the library does not know yet still arrive as a general API error.
  • Retries. 5xx answers, network errors and timeouts are retried up to 3 times with growing waits. A burst 429 waits for Retry-After and tries once more. 400, 401, 403, 404 and a monthly 429 are never retried. See Rate limits & credits.
  • Forward compatibility. New fields and new values from the server do not break the clients. Values such as role, event types or source.type are open strings with known constants, not closed enums.
  • Missing, null and empty stay apart. A block that is missing (not requested, not in your plan, or the raw channel) is not turned into null or []. Helpers such as companiesPresent tell you which case you have. See The article object.

Nothing in the libraries is special: everything they do works over plain HTTP and WebSocket. cURL or any HTTP client stays a fully supported option.


Versions

The SDK version and the API version are separate numbers. Each library has one major version for API v3 and one older major version for v1 and v2:

LanguageSpeaks API v3Speaks API v2
TypeScript / JavaScript4.x3.x, no further releases
Python3.x2.x, no further releases
Gov2.x (github.com/callbk/finlight-client-go/v2)v1.x (github.com/callbk/finlight-client-go), no further releases
.NET2.x1.x, no further releases
Java / Kotlin1.x0.1.x, no further releases
PHP2.x1.x, no further releases
Ruby1.x0.x, no further releases
Rust0.2.x0.1.x, no further releases
  • New fields and new values in API v3 arrive as compatible releases of the v3 major (for Rust, as 0.2.x releases).
  • The old majors stay on the registries and keep working against API v2. API v2 is deprecated, but it is not switched off.
  • A new major does not run code written for the old one. The README of each library has a "Migrating" section, and the migration guide covers the API side.

Pin a major version

Pin the major version you use, so a routine dependency update never moves you to an incompatible client:

LanguageStays on the v2 clientMoves to the v3 client
TypeScriptfinlight-client@^3finlight-client@^4
Pythonfinlight-client<3finlight-client>=3,<4
Goimport github.com/callbk/finlight-client-goimport github.com/callbk/finlight-client-go/v2
.NET[1.0.0,2.0.0)[2.0.0,3.0.0)
Java / Kotlin0.1.01.0.0
PHPfinlight/client:^1.0finlight/client:^2.0
Ruby"~> 0.1.0""~> 1.0"
Rustfinlight-client = "0.1"finlight-client = "0.2"

The usual compatible ranges (^, ~, ~>, the Cargo default) never pull in the next major. Open ranges such as * or >= do, so avoid them.


What's next?