Grants
Client libraries
Drop-in API wrappers for Grants in Python, TypeScript, JavaScript, Go, Java, Rust, C#, C++, PHP, Ruby, Kotlin, Swift, Dart, Elixir, and Clojure.
Each library is a single source file you download from this page and drop into your project. Most languages need nothing else - the file uses only the standard library. Rust is the one exception: add the two crates listed in the file header (reqwest + serde_json) to your Cargo.toml and you're done. Every endpoint the Grants HTTP API exposes is wrapped as a typed function named after the data model and operation, so the surface mirrors the REST API one-to-one. Authentication uses the same personal access tokens the rest of the API accepts. The libraries are easy to vendor, audit, and extend directly in your own codebase.
Download
Pick your language and download the single source file. Module name for Grants: grants_client. Class name for languages with an explicit wrapper type: GrantsClient.
Python
grants_client.py
checksum: c452d24f75…
TypeScript
grants_client.ts
checksum: fe07961ec6…
JavaScript
grants_client.js
checksum: 944b532980…
Go
grants_client.go
checksum: 8f392feb14…
Java
GrantsClient.java
checksum: 0fc3b22864…
Rust
grants_client.rs
checksum: 10523acd7f…
C# / .NET
GrantsClient.cs
checksum: 4cab976b84…
C++
GrantsClient.hpp
checksum: 04d183b380…
PHP
grants_client.php
checksum: ef805b6c8f…
Ruby
grants_client.rb
checksum: 4ff8a3c99e…
Kotlin
GrantsClient.kt
checksum: c8813395de…
Swift
GrantsClient.swift
checksum: 206632fd39…
Dart
grants_client.dart
checksum: 77f41ac24a…
Elixir
grants_client.ex
checksum: 0011b29679…
Clojure
grants_client.clj
checksum: 9af5e81d14…
0.3.13·Module: grants_client·Models: 10Per-language vendoring tips
- PythonDrop
grants_client.pyinto your package;from grants_client import .... Pure stdlib (urllib.request/json/threading); requires Python 3.8+. - TypeScriptDrop
grants_client.tsnext to your other TS files. Type-checks under any combination of@types/node+ DOM lib via small built-in shims; runtime usesfetch(Node 18+ / browser). - GoPlace
grants_client.goinside a directory namedgrants_client/so the file'spackage grants_clientdeclaration matches its import path. - JavaPlace
GrantsClient.javainside a directory namedgrants_client/matching the file'spackage grants_client;declaration. Targets JDK 11+; uses java.net.http only. - RustAdd the file as a module (
mod grants_client;in yourlib.rsormain.rs) and add the two crates listed in the file header (reqwestwith theblocking,jsonfeatures, plusserde_json) to your Cargo.toml. - C# / .NETPlace
GrantsClient.csin any folder; the file declaresnamespace grants_client;. Targets .NET 6+; uses HttpClient + System.Text.Json only - no NuGet packages. - PHP
require_once __DIR__ . '/grants_client.php'from your bootstrap, or autoload the namespacegrants_client\\via Composer's PSR-4. Requires PHP 8.0+ with thecurlandjsonextensions (both default). - Ruby
require_relative 'grants_client'from anywhere in your project. The wrapper class isGrantsClient::Client. Targets Ruby 3.0+; pure stdlib (net/http,json,securerandom). - KotlinPlace
GrantsClient.ktinside a directory namedgrants_client/matching the file'spackage grants_clientdeclaration. Targets Kotlin 1.9+ on JVM 11+; pure JDK only. - SwiftDrop
GrantsClient.swiftnext to your other Swift files. Targets Swift 5.7+ (macOS 12 / iOS 15 / Linux with FoundationNetworking).
Authenticate
Create a personal access token (PAT) from the Integrations menu and pass it to the library at runtime. Every language exposes the same two configuration knobs: an explicit setToken(...) call, or the XCLIENT_TOKEN environment variable for CI / scripted use. Tokens are sent as Authorization: Bearer ... on every request and the library never logs them.
from grants_client import set_tokenset_token("pat_…")# or, equivalently:# export XCLIENT_TOKEN=pat_…
Use the library
Save the downloaded file under your project as grants_client.py (or the equivalent for your language) and import the operation functions you need. Each function is named <model>_<op> (account_create, deal_list, lead_get, ...) and forwards to the matching HTTP endpoint with retry-on-429, exponential backoff, and Retry-After honoured automatically. List functions accept the standard query parameters (limit, offset, sort, q, plus the type's allowed filters); get/update/delete functions accept the row id as their first argument.
from grants_client import derived_doc_list, derived_doc_get, derived_doc_create, derived_doc_update, derived_doc_delete# List the first 20 rowspage = derived_doc_list(limit=20, sort="-created_at")print(page["data"], page["meta"]["has_more"])# Create + read + update + deletecreated = derived_doc_create({"name": "Example"})fresh = derived_doc_get(created["id"])derived_doc_update(created["id"], {"name": "Updated"})derived_doc_delete(created["id"])
Available models
Each library exposes one function per operation per model. The list below is the one-to-one mirror of the HTTP endpoints this app exposes.
| Model | Functions |
|---|---|
| derived_doc | derived_doc_listderived_doc_getderived_doc_createderived_doc_updatederived_doc_delete |
| feedback_item | feedback_item_listfeedback_item_getfeedback_item_createfeedback_item_updatefeedback_item_delete |
| feedback_point | feedback_point_listfeedback_point_getfeedback_point_createfeedback_point_updatefeedback_point_delete |
| file | file_listfile_getfile_createfile_updatefile_delete |
| folder | folder_listfolder_getfolder_createfolder_updatefolder_delete |
| grant | grant_listgrant_getgrant_creategrant_updategrant_delete |
| lead | lead_listlead_getlead_createlead_updatelead_delete |
| loi | loi_listloi_getloi_createloi_updateloi_delete |
| review_note | review_note_listreview_note_getreview_note_createreview_note_updatereview_note_delete |
| version_snapshot | version_snapshot_listversion_snapshot_getversion_snapshot_createversion_snapshot_updateversion_snapshot_delete |
Environment variables
| Variable | Purpose |
|---|---|
| XCLIENT_TOKEN | Personal access token used for every API call. |
| XCLIENT_BASE_URL | Override the baked-in server URL (testing only). |
Analytics + updates
Each call sends one analytics event to the same dashboard as the web UI (operation name, library version, OS - no field values, no request bodies) so the team running this app can see how the integration is used. The data is processed securely; an audit log of every event tied to you can be requested at any time from the company operating the app. Separately, the library checks for a newer version once every 24 hours. In interpreted languages (Python, TypeScript on Node, JavaScript on Node, PHP, Ruby, Elixir) the on-disk file is replaced atomically and the next import picks up the new bytes. In compiled languages (Go, Java, Rust, C#, C++, Kotlin, Swift, Dart, Clojure) the source file is left as-is - users ship pre-compiled artefacts, so the version probe just stamps a timestamp you can surface at build-time. Set XCLIENT_NO_AUTOUPDATE=1 to disable the probe entirely.