API Reference

This document describes the public and API-key authenticated endpoints of the AzothPay API

Base URL

https://azothpay.com/api/

Authentication

Endpoints marked with the ApiKey security scheme require an API key to be included in the request header:

X-API-Key: <your-api-key>

API keys can be created via JWT-authenticated endpoints (excluded from this documentation).


Public Endpoints

Get API Information and Status

GET /

Returns general information about the API and status of smart contracts.

  • Response (200 OK)

    {
      "Message": "string",
      "Contracts": { }
    }

API-Key Authenticated Endpoints

All endpoints below require a valid API key in the X-API-Key header.


Contracts

Get List of Available Contracts

GET /api/v1/contracts

Returns a list of all available smart contracts.

  • Response (200 OK)

    [
      {
        "Name": "string",
        "Address": "string"
      }
    ]

Subscriptions

Create a New Subscription

POST /api/v1/{contract}/subscriptions/

Creates a new subscription/payment stream to an author.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "from": "string",
      "author": "string",
      "subscription_rate": "string",
      "project_id": "string",
      "sponsor": "string"
    }
  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

List User’s Active Subscriptions

GET /api/v1/{contract}/subscriptions/{address}

Retrieves all active subscriptions for a given user address.

  • Path Parameters

    • contract (string, required)

    • address (string, required)

  • Response (200 OK)

    {
      "Address": "string",
      "Subscriptions": [
        {
          "To": "string",
          "EncodedRates": "string"
        }
      ]
    }

Cancel a Subscription

DELETE /api/v1/{contract}/subscriptions/{author}

Cancels an existing subscription to an author.

  • Path Parameters

    • contract (string, required)

    • author (string, required)

  • Query Parameters (optional)

    • From (string)

    • Sponsor (string)

  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

Payments

Make a One-Time Payment

POST /api/v1/{contract}/payments/

Creates a transaction to send a one-time payment.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "From": "string",
      "To": "string",
      "Amount": "string",
      "Sponsor": "string"
    }
  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

Deposit Funds

POST /api/v1/{contract}/payments/deposit

Deposits funds into a user's account.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "From": "string",
      "Amount": "string",
      "IsPermit2": true,
      "Sponsor": "string"
    }
  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

Withdraw Funds

POST /api/v1/{contract}/payments/withdraw

Withdraws funds from a user's account.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "From": "string",
      "Amount": "string",
      "To": "string",
      "Sponsor": "string"
    }
  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

Get Account Balance

GET /api/v1/{contract}/payments/balance/{address}

Retrieves the balance of a user's account.

  • Path Parameters

    • contract (string, required)

    • address (string, required)

  • Response (200 OK)

    {
      "Address": "string",
      "Balance": "string"
    }

Meta Transactions

Get Account Nonce

GET /api/v1/{contract}/meta/nonce/{account}

Retrieves the current nonce for a given account.

  • Path Parameters

    • contract (string, required)

    • account (string, required)

  • Response (200 OK)

    {
      "Account": "string",
      "Nonce": 0
    }

Execute Meta Transaction

POST /api/v1/{contract}/meta/execute

Executes a meta transaction signed by the user.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "From": "string",
      "Signature": "string",
      "Data": "string",
      "Nonce": 0,
      "Sponsor": "string",
      "Deadline": 0
    }
  • Response (200 OK)

    {
      "Message": "string",
      "From": "string",
      "TransactionHash": "string",
      "GasUsed": 0
    }

Batch Operations

Create Multiple Subscriptions

POST /api/v1/{contract}/batch/subscriptions

Creates multiple subscriptions in a single sponsored call.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "From": "string",
      "Subscriptions": [
        {
          "Author": "string",
          "SubscriptionRate": "string",
          "ProjectId": "string"
        }
      ],
      "Sponsor": "string"
    }
  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

Process Batch Payments

POST /api/v1/{contract}/batch/payments

Sends payments to multiple recipients in one transaction.

  • Path Parameters

    • contract (string, required)

  • Request Body

    {
      "From": "string",
      "Payments": [
        {
          "To": "string",
          "Amount": "string"
        }
      ],
      "Sponsor": "string"
    }
  • Response (200 OK)

    {
      "Message": "string",
      "Transaction": null
    }

Error Responses (Common)

All authenticated endpoints may return the following standard HTTP error codes:

  • 400 Bad Request – Invalid input or missing required fields.

  • 401 Unauthorized – Missing or invalid API key.

  • 403 Forbidden – Access denied (should not occur with valid API key for these endpoints).

  • 500 Internal Server Error – Unexpected server error.


Last updated