Skip to main content

Install

Prepare the example

Use a server-side Node.js application with ES module support. This example uses process.env and top-level await; it must not be bundled into a public website with an organization key. Set LEADPING_API_KEY in the process environment and replace lead-id with a lead from the key’s organization. The Kiota versions above match the SDK’s current dependency line. Mixing newer adapter and abstraction versions with an older SDK can produce incompatible RequestAdapter types. When upgrading the SDK, inspect its dependencies and update these packages together. Save the example as read-lead.mts. A minimal compilation and execution command is:
Commit the dependency lockfile so another environment installs the same versions.

Create the client

The client defaults to https://api.leadping.ai. Set LEADPING_API_KEY to an organization API key. client.users.me requires a user access token; source keys are only for lead intake. The SDK does not store or refresh credentials. See API Authentication.

Call routes

Use generated request-body and model types from @leadping/sdk when creating or updating records. Confirm endpoint contracts in the API Reference, and handle 429 responses using the rate-limit guide.

Integrate with your application

Keep one configured client for the credential context it serves. Catch rejected requests at your job or request boundary, record a redacted status and operation, and apply the retry policy. Avoid returning a caught error as an empty lead result: callers need to distinguish “not found” from “could not authenticate.” The generated methods return optional model properties. Check fields before rendering or using them in a business rule, and use the types from your installed package when constructing a request body.