Lava top
For developers

Welcome to the lava.top API portal!

With our API, you can easily set up integrations: manage products, access sales reports, work with subscriptions, accept donations, and configure webhook notifications.
We've made the documentation as simple and clear as possible. Here you’ll find everything you need to quickly understand which parameters to use, what responses to expect, and how to best configure your integration.

Introduction

Support

If anything is unclear, feel free to contact our support team: support@lava.top.

General Information

Integration is the process of connecting two or more services using an API. It allows systems to exchange data and events, enabling them to work together in an automated and coordinated way.

With lava.top, you can set up integration with any external system, service, website, or Telegram bot — to accept and track payments, manage access, and control subscription statuses. This makes your workflows simpler and more convenient.

Key Terms:
Public API

Public API — lava.top's public programming interface that allows external software and applications to interact with each other over the network.

API Key

API Key — a unique code used for the authorization and authentication of an API client. Think of it as a login and password, but for software — without it, you can't access the data or features provided by the API.

Webhook

Webhook — a mechanism that allows one service to automatically send data to another in response to certain events. In simple terms, it’s a notification your system receives when something happens. Instead of constantly asking the server “what’s new?”, you configure a URL once, and the server notifies you when needed.

Typical scenarios for using our API:
Product purchase and 1st subscription payment

diagram1diagram1

Subscription 2nd and subsequent recurring payments

diagram2diagram2

API Key and Webhook Setup

Getting started

To get started with integrating your service on the platform, you need to create an API key and set up a webhook.

How to Create an API Key

1
How to Create an API Key
  1. Go to the My Page section and click Profile in the top-right corner.
  2. Navigate to the Integration tab and click Add API Key.

screenshot1.pngscreenshot1.png

  1. The platform will generate the key automatically — copy it and save it securely on your device.

screenshot2.pngscreenshot2.png

How to Set Up a Webhook

2
How to Set Up a Webhook
  1. Create an API key and confirm that you’ve saved it.
  2. Click the Add Webhook button.

screenshot3.pngscreenshot3.png

  1. Fill in the following fields:
  • URL — the endpoint on your server where webhook data will be sent (this is the address that will receive and process requests).
  • Event type:
  1. Payment result — one-time purchase: use this type for one-time payments as well as the first payment in a subscription.
  2. Recurrent payment — subscription payment: used for second, third, and all subsequent subscription charges.

screenshot4.pngscreenshot4.png

Important! To properly set up subscription billing, you need to create two webhooks: one with the "Payment result" type — it will handle the initial subscription payment. Another with the "Recurring payment" type — it will handle all following charges.
  1. Choose an authentication method:
  • Basic - enter the login and password for your service that will receive webhook requests.

screenshot5.pngscreenshot5.png

  • Your service’s API key - enter the API key of your service that will receive the webhook requests. Maximum key length: 80 characters.

screenshot6.pngscreenshot6.png

Basic authentication: lava.top will send webhook requests to the specified URL using HTTP Basic Authentication. The request will be sent in the format: user:pass@example.com. Only HTTPS connections are allowed for this type of request to ensure security.

API Key Authentication: lava.top will send webhook requests to the specified URL, authenticated using an API key.The receiving server must extract the key from the HTTP header: "X-Api-Key".

How to add a webhook to an existing API key

Click the three dots next to the desired key and select Add Webhook.

screenshot7.pngscreenshot7.png

After completing these steps, you can proceed to the API documentation and continue your integration.

API Documentation

API Documentation

To get a detailed overview of available API methods, refer to our API documentation.

The documentation follows the Open API v3.0.0 (Swagger) specification.

API Documentation

Swagger documentation with interactive examples

You can find API methods grouped by the most common use cases:

Products

Products - work with digital products: fetch the product list and update their parameters (e.g., price).

Invoices

Invoices - create purchase contracts and check their status.

Reports

Reports - access sales analytics data via the API.

Subscriptions

Subscriptions - manage user subscriptions.

Donate

Donate - generate donation links.

Interactive documentation allows you to test each method and ensure it works correctly.

To try out a method:
  1. provide your API key:
  • Click Authorize in the top-right corner of the page:

screenshot8.pngscreenshot8.png

  • fill in ApiKeyAuth (apiKey), (use the API key you received in the Author’s personal account interface at lava.top: My Page → Profile → Integration → Add API Key (we explained this in more detail here)):

screenshot9.pngscreenshot9.png

  1. click Try it out, enter the required data, and select Execute:

screenshot10.pngscreenshot10.png

API Libraries

API Libraries

We’ve prepared several open-source libraries to help you use our platform more easily and efficiently.

Our API follows the Open API (Swagger) specification, which can be complex to work with — these libraries are designed to simplify the process.

!Python

Python

Get the package PyPI, typically via pip:

Install
1.pip install lava-top-sdk

Make sure that, however you install lava-top-sdk, you install its dependencies as well.

!TypeScript

TypeScript

Available on npm

Install
1.npm install --save lava-top-sdk

Clients and API Keys

Clients and API Keys

Lava.top uses two types of API keys, each serving a specific role in the integration process:

API Key for signing requests to lava.top

This key is used by your system to send API requests to lava.top. It allows us to identify and authorize your application.

API Key for signing webhooks from lava.top

This key is generated on your side and shared with lava.top. The platform uses it to sign webhook requests by adding it to the X-Api-Key HTTP header when sending data to your server.

Both keys are essential to ensure a secure and reliable integration between your system and lava.top.

Errors

Errors

Lava.top uses standard HTTP response codes to indicate whether an API request was successful or if an error occurred.

All outgoing connections originate from the IP address 158.160.60.174

Important: Please make sure to whitelist this IP on your side!
Retry Policy

If the webhook is not delivered, the system will automatically try to resend it to the specified URL. The first attempt will be in one second, the second in five seconds, and the third in 15 seconds. The system will then make ten attempts with an interval of one minute. After that, if unsuccessful, the system will make five more attempts with an interval of one hour.

Up to 20 attempts will be made in total.

The most common errors:

CodeDescriprion
400Bad Request: The request is invalid. Check syntax, parameters, size limits, etc.
401Unauthorized: Authentication error. Verify your API key, OAuth token, token expiration, or required scopes.
403Forbidden: Access to the resource is denied. You may lack permissions or be trying to access a restricted resource.
404Not Found: The resource was not found. Check the URL, object ID, or whether the resource exists in your account.
405Method Not Allowed: The HTTP method is not supported for this endpoint. Refer to the API documentation.
406Not Acceptable: Unsupported request or response format. The API only supports application/json.
408Request Timeout: The server timed out waiting for the request to complete. Try resending with smaller data payloads.
410Gone: The resource has been permanently deleted and is no longer available.
429Too Many Requests: Rate limit exceeded. Reduce the frequency of requests.
500Internal Server Error: A server-side error occurred. Try again later.
503Service Unavailable: The service is temporarily unavailable due to maintenance or overload. Please try again later.

Rate Limits

Rate Limits

Lava.top applies request rate limiting to protect against overload and ensure stable API performance.

50
Current limit: up to 50 requests per second per IP address.
If this limit is exceeded, the server will respond with an error code 429. In this case, it's recommended to wait before retrying the request.
For high-load services, feel free to contact our support team: support@lava.top

Webhook

Webhook

As mentioned earlier, in the Integration section of the Author’s profile settings, you can create API keys and add webhooks.

You can also view the sending attempt history, check the status of each webhook, and re-send any webhook that failed to be delivered or processed.

!Webhook History

Webhook History

You can find the webhook history in your account card. To access it, go to Profile SettingsIntegrationWebhook History.

screenshot11.pngscreenshot11.png

This section logs all events linked to your configured webhooks. Events are categorized by type, status, and the API Key + webhook pair.

In the payment details, you can view the full request body sent at the time of the event, along with the delivery attempt history. To see these details, simply click on the corresponding webhook entry.

Advanced filters are available to help you quickly find the webhook you need — you can search by Buyer's email, Invoice ID, Product name, or Product ID.

screenshot12.pngscreenshot12.png

!Events Types

Events Types

Each event is associated with a payment type and a contract status.

Payment Types:

  • one-time payment (purchasing a digital product, course, consultation, or the first payment in a subscription);
  • recurring payment (subscription renewal or cancellation).

Contract Statuses:

  • success (payment was successful);
  • failed (payment was not completed, e.g. insufficient funds);
  • cancelled (the subscription was cancelled).

Based on this, you may encounter the following Event types:

  • payment.successpayment.success — successful purchase of a product (not a donation) or the first subscription payment;
  • payment.failedpayment.failed — failed product purchase (not a donation) or failed first subscription payment;
  • subscription.recurring.payment.successsubscription.recurring.payment.success — successful renewal of a subscription (second, third, and later payments);
  • subscription.recurring.payment.failedsubscription.recurring.payment.failed — failed subscription renewal;
  • subscription.cancelledsubscription.cancelled — cancellation of a previously active subscription.

To receive these events, you need to set up the appropriate webhook. When creating a webhook, you must choose one of the two event types:

  • Webhook with type Payment result (receives only payment.successpayment.success and payment.failedpayment.failed .)
  • Webhook with type Recurring payment (receives only subscription.recurring.payment.successsubscription.recurring.payment.success , subscription.recurring.payment.failedsubscription.recurring.payment.failed and subscription.cancelledsubscription.cancelled ).

screenshot13.pngscreenshot13.png

!Webhook Status

Webhook Status

The status indicates whether the webhook was successfully received.

screenshot14.pngscreenshot14.png

A webhook can have one of two statuses:

  • DELIVERED — the webhook was successfully delivered.
  • FAILED — the webhook delivery failed.

The status is determined based on the HTTP response code returned by your server when the event is sent.

!Retry Policy

Retry Policy

Lava.top uses HTTP status codes to determine whether an API request was successfully processed or failed.

If a webhook delivery fails (i.e., a non-successful HTTP status code is returned), lava.top will retry the delivery up to 19 additional times, for a total of 20 attempts.

If webhooks were not delivered, the system will attempt to resend them to the specified URL. Repeated attempts are made according to the logic: first 1s, 5s, 15s, then 10 attempts with an interval of 1 min, then, if unsuccessful, another 5 attempts with an interval of 1 hour.

In total, 20 delivery attempts will be made.

Each attempt is logged in the webhook history with the corresponding HTTP status code. If a successful status code is received, no further retries will be made. In that case, you’ll see only one event logged (successful or failed payment).

In case of an unsuccessful response, up to 20 attempts may be made (retries stop after a successful delivery or after 19 retry attempts).

You can view all retry attempts in the "Sending attempt history" section of the webhook details.

screenshot15.pngscreenshot15.png

Most common response codes:

  • Code 401 / Code 403 — Invalid authentication data; access to the webhook handler is denied;
  • Code 404 — The webhook contains an incorrect URL (the link to the author's server that receives and processes the webhook is invalid)
  • Code 500 — An error occurred on the author's server that is responsible for handling the webhook.

screenshot16.pngscreenshot16.png

!Webhook Resend

Webhook Resend

You can manually resend any webhook by clicking the arrow icon next to it.

screenshot17.pngscreenshot17.png

Click the icon and confirm the resend action.

screenshot18.pngscreenshot18.png

Changelog

Changelog

We regularly improve integration capabilities by adding new features, fixing bugs, and updating the documentation. Here you can keep track of all the changes.

July 2025
Последнее

Subscription payments via Stripe are now supported.

Implemented /api/v2/invoices and /api/v2/invoices/{id} endpoints with updated contract typing:

  • INVOICEINVOICE - payment for products, consultations, or courses,
  • SUBSCRIPTION_FIRST_INVOICESUBSCRIPTION_FIRST_INVOICE - first subscription charge,
  • SUBSCRIPTION_RENEWALSUBSCRIPTION_RENEWAL - recurring subscription payment.
April 2025

Donation payments via Stripe are now supported.

Improved GET /invoices request: now returns the parentInvoiceId field (ID of the parent transaction for subscriptions).

February 2025

PayPal support added:

  • Subscription payments,
  • Donation sending.

Webhook improvements:

  • Manual retry option,
  • Webhook list retrieval,
  • Event type now included in the webhook payload,
  • Ability to search webhooks by Product ID in the Author Dashboard (Profile → Integrations → Webhook History).
January 2025

UTM tags added.

December 2024

Stripe payment support added for digital products.

FAQs

FAQs

Here we've collected the most frequently asked questions that may come up when using our API.

!General questions

General questions

!What IP addresses are used to send webhooks?

What IP addresses are used to send webhooks?

!What URL should I use to send requests (LAVA_API_URL)?

What URL should I use to send requests (LAVA_API_URL)?

!How to accept payments via API?

How to accept payments via API?

!How to correctly set currency and payment method?

How to correctly set currency and payment provider?

!Is it necessary to respond to a webhook request?

Is it necessary to respond to a webhook request?

!Is there a sandbox environment?

Is there a sandbox environment?

!Which parameter is used to pass the API key?

Which parameter is used to pass the API key?

!Can webhooks be sent to an HTTP URL?

Can webhooks be sent to an HTTP URL?

!Is it necessary for the user to enter an email address on the service side?

Is it necessary for the user to enter an email address on the service side?

!Is data validation performed?

Is data validation performed?

!A client purchased a product, but I didn’t receive a webhook. Why?

A client purchased a product, but I didn’t receive a webhook. Why?
Is there a time limit for the payment link?
Can I pass custom data when generating a payment link?

!Product Purchase/Sale

Product Purchase/Sale

!What does a webhook look like for product payments:

What does a webhook look like for product payments:

!Can a hidden product on the author’s page be accessed via the API?

Can a hidden product on the author’s page be accessed via the API?

!Subscriptions

Subscriptions

!How to create a recurring payment?

How to create a recurring payment?

!How to create a subscription with recurring payments longer than one month?

How to create a subscription with recurring payments longer than one month?

!How to accept subscription payments with different billing periods?

How to accept subscription payments with different billing periods?

!What subscription billing periods are available?

What subscription billing periods are available?

!What’s the difference between contractId and parentContractId?

What’s the difference between contractId and parentContractId?

!What does a webhook for a subscription payment look like?

What does a webhook for a subscription payment look like?

!Are there additional charge attempts if a payment fails?

Are there additional charge attempts if a payment fails?

!How can an author cancel a client's subscription?

How can an author cancel a client's subscription?

!Can I check the subscription status via API?

Can I check the subscription status via API?

!Can the same subscription be purchased twice?

Can the same subscription be purchased twice?

!How can I update the subscription price?

How can I update the subscription price?

!Webhook Events

Webhook Events

!If a webhook wasn't sent due to an error, will it be sent later?

If a webhook wasn't sent due to an error, will it be sent later?

!No event in webhook history — what does it mean?

No event in webhook history — what does it mean?

!Is it possible to get information on all webhooks for the past period?

Is it possible to get information on all webhooks for the past period?

!How to find a specific event using filters?

How to find a specific event using filters?

!What do HTTP status codes mean in webhooks?

What do HTTP status codes mean in webhooks?

!Can a webhook be resent?

Can a webhook be resent?

Ready to start?

Create an API key and start integrating
payments into your service today