> ## Documentation Index
> Fetch the complete documentation index at: https://developer.notchpay.co/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Complete reference documentation for the Notch Pay API

# API Reference

<div className="bg-gradient-to-r from-green-50 to-teal-50 dark:from-green-900/30 dark:to-teal-900/30 p-6 rounded-lg mb-8 border border-green-100 dark:border-green-900/50">
  <h2 className="text-xl font-bold text-green-800 dark:text-green-400 mb-2">Complete Notch Pay API Documentation</h2>
  <p className="text-gray-700 dark:text-gray-300">This reference provides detailed information about all endpoints, request parameters, and response formats for the Notch Pay API.</p>
</div>

<Tabs>
  <Tab title="Overview">
    <p className="text-gray-700 dark:text-gray-300 mb-4">
      The Notch Pay API is organized around REST principles. It uses standard HTTP verbs, returns JSON-encoded responses, and uses standard HTTP response codes to indicate API errors.
    </p>

    <p className="text-gray-700 dark:text-gray-300 mb-4">
      Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients.
    </p>
  </Tab>

  <Tab title="Features">
    <div className="grid grid-cols-1 md:grid-cols-2 gap-4 mt-2">
      <div className="flex items-start">
        <div className="mt-1 mr-3 text-green-600">
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
          </svg>
        </div>

        <div>
          <p className="font-medium">RESTful Design</p>
          <p className="text-sm text-gray-600 dark:text-gray-400">Predictable resource-oriented URLs</p>
        </div>
      </div>

      <div className="flex items-start">
        <div className="mt-1 mr-3 text-green-600">
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
          </svg>
        </div>

        <div>
          <p className="font-medium">JSON Responses</p>
          <p className="text-sm text-gray-600 dark:text-gray-400">All responses are in JSON format</p>
        </div>
      </div>

      <div className="flex items-start">
        <div className="mt-1 mr-3 text-green-600">
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
          </svg>
        </div>

        <div>
          <p className="font-medium">Comprehensive Error Handling</p>
          <p className="text-sm text-gray-600 dark:text-gray-400">Detailed error messages and codes</p>
        </div>
      </div>

      <div className="flex items-start">
        <div className="mt-1 mr-3 text-green-600">
          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
          </svg>
        </div>

        <div>
          <p className="font-medium">Webhooks Support</p>
          <p className="text-sm text-gray-600 dark:text-gray-400">Real-time event notifications</p>
        </div>
      </div>
    </div>
  </Tab>

  <Tab title="Getting Started">
    <Steps>
      <Step title="Create an Account">
        Sign up for a Notch Pay account at <a href="https://business.notchpay.co/register" className="text-green-600 hover:underline">business.notchpay.co</a>
      </Step>

      <Step title="Get Your API Keys">
        Find your API keys in your dashboard under Settings > API Keys
      </Step>

      <Step title="Make Your First API Call">
        Follow our <a href="/get-started/quickstart" className="text-green-600 hover:underline">Quickstart Guide</a> to make your first API call
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Getting Started

<CardGroup cols={2}>
  <Card title="Base URL" icon="globe" color="#16A34A">
    All API requests should be made to:

    ```bash theme={null}
    https://api.notchpay.co
    ```
  </Card>

  <Card title="Authentication" icon="key" color="#16A34A">
    Include your API key in the `Authorization` header:

    ```bash theme={null}
    Authorization: YOUR_PUBLIC_KEY
    ```

    <a href="/api-reference/authentication" className="text-blue-500 hover:underline">Learn more about authentication →</a>
  </Card>
</CardGroup>

## API Environments

<Tabs>
  <Tab title="Test Environment">
    <div className="flex items-start">
      <div className="mt-1 mr-3">
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke="currentColor" className="text-amber-500">
          <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
        </svg>
      </div>

      <div>
        <h3 className="text-lg font-semibold">Development & Testing</h3>
        <p className="mt-1">Use test API keys that start with <code>test\_</code></p>
        <p className="mt-2">Test transactions don't affect real money and are only visible in test mode.</p>

        <Callout type="info" className="mt-3">
          Test cards and accounts are available in the <a href="/get-started/testing" className="text-blue-500 hover:underline">Testing Guide</a>.
        </Callout>
      </div>
    </div>
  </Tab>

  <Tab title="Live Environment">
    <div className="flex items-start">
      <div className="mt-1 mr-3">
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke="currentColor" className="text-green-500">
          <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
        </svg>
      </div>

      <div>
        <h3 className="text-lg font-semibold">Production</h3>
        <p className="mt-1">Use live API keys that start with <code>live\_</code></p>
        <p className="mt-2">Live transactions involve real money and appear in your Notch Pay dashboard.</p>

        <Callout type="warning" className="mt-3">
          Only use live keys when your integration is thoroughly tested and ready for production.
        </Callout>
      </div>
    </div>
  </Tab>
</Tabs>

## Response Format

<CodeGroup>
  ```json Success Response theme={null}
  {
    "code": 200,
    "status": "OK",
    "message": "Descriptive message",
    "data": {
      "id": "pay_123456789",
      "amount": 5000,
      "currency": "XAF",
      "status": "complete"
    }
  }
  ```

  ```json Error Response theme={null}
  {
    "code": 400,
    "status": "Bad Request",
    "message": "Error message",
    "errors": {
      "field_name": ["Error description"]
    }
  }
  ```
</CodeGroup>

## HTTP Status Codes

<AccordionGroup>
  <Accordion title="Success Codes (2xx)" defaultOpen>
    <ResponseField name="200" type="OK">
      The request was completed
    </ResponseField>

    <ResponseField name="201" type="Created">
      A new resource was created
    </ResponseField>

    <ResponseField name="202" type="Accepted">
      The request has been accepted for processing
    </ResponseField>
  </Accordion>

  <Accordion title="Client Error Codes (4xx)">
    <ResponseField name="400" type="Bad Request">
      The request was invalid or cannot be served
    </ResponseField>

    <ResponseField name="401" type="Unauthorized">
      Authentication credentials are missing or invalid
    </ResponseField>

    <ResponseField name="403" type="Forbidden">
      The authenticated user doesn't have permission
    </ResponseField>

    <ResponseField name="404" type="Not Found">
      The requested resource doesn't exist
    </ResponseField>

    <ResponseField name="422" type="Unprocessable Entity">
      The request was well-formed but contains semantic errors
    </ResponseField>

    <ResponseField name="429" type="Too Many Requests">
      Rate limit exceeded
    </ResponseField>
  </Accordion>

  <Accordion title="Server Error Codes (5xx)">
    <ResponseField name="500" type="Internal Server Error">
      An error occurred on the server
    </ResponseField>

    <ResponseField name="503" type="Service Unavailable">
      The server is temporarily unavailable
    </ResponseField>
  </Accordion>
</AccordionGroup>

## Rate Limiting

<Callout type="warning">
  The Notch Pay API implements rate limiting to protect against abuse. If you exceed the rate limit, you'll receive a `429 Too Many Requests` response.
</Callout>

<Steps>
  <Step title="Rate Limit Headers">
    Each response includes headers that provide information about your current rate limit status:

    ```
    X-RateLimit-Limit: 100
    X-RateLimit-Remaining: 98
    X-RateLimit-Reset: 1620000000
    ```
  </Step>

  <Step title="Handling Rate Limits">
    When you receive a `429` response, the `Retry-After` header indicates how many seconds to wait before making another request.

    ```
    Retry-After: 30
    ```

    Implement exponential backoff in your code to handle rate limiting gracefully.
  </Step>
</Steps>

## API Resources

<CardGroup cols={3}>
  <Card title="Payments" icon="credit-card" href="/api-reference/payments" color="#16A34A">
    Create, retrieve, and manage payments
  </Card>

  <Card title="Transfers" icon="money-bill-transfer" href="/api-reference/transfers" color="#16A34A">
    Send money to beneficiaries
  </Card>

  <Card title="Customers" icon="users" href="/api-reference/customers" color="#16A34A">
    Create and manage customer information
  </Card>

  <Card title="Beneficiaries" icon="user-plus" href="/api-reference/beneficiaries" color="#16A34A">
    Manage recipients for money transfers
  </Card>

  <Card title="Webhooks" icon="bell" href="/api-reference/webhooks" color="#16A34A">
    Configure and manage webhook endpoints
  </Card>

  <Card title="Balance" icon="wallet" href="/api-reference/balance" color="#16A34A">
    Check your account balance
  </Card>

  <Card title="Resources" icon="database" href="/api-reference/resources" color="#16A34A">
    Get information about payment channels, countries, and currencies
  </Card>

  <Card title="Authentication" icon="shield-halved" href="/api-reference/authentication" color="#16A34A">
    Learn about authentication methods and security
  </Card>
</CardGroup>

## API Versioning

<Callout type="info">
  The current version of the API does not require a version specifier in the URL. Future versions may be accessed by including a version number in the URL or headers.
</Callout>

## SDKs and Libraries

<Tabs>
  <Tab title="Official SDKs">
    <CardGroup cols={4}>
      <Card title="JavaScript" icon="js" href="/sdks/javascript">
        Node.js and browser SDK
      </Card>

      <Card title="PHP" icon="php" href="/sdks/php">
        PHP SDK for server-side integration
      </Card>

      <Card title="Python" icon="python" href="/sdks/python">
        Python SDK for server-side integration
      </Card>

      <Card title="Mobile" icon="mobile-screen" href="/sdks/mobile">
        iOS and Android SDKs
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Community Libraries">
    <CardGroup cols={3}>
      <Card title="Laravel" icon="laravel" href="/sdks/laravel">
        Laravel package for Notch Pay
      </Card>

      <Card title="WordPress" icon="wordpress" href="/sdks/wordpress">
        WordPress plugin for Notch Pay
      </Card>

      <Card title="WooCommerce" icon="shopping-cart" href="/sdks/woocommerce">
        WooCommerce payment gateway
      </Card>
    </CardGroup>
  </Tab>
</Tabs>

## Need Help?

<CardGroup cols={3}>
  <Card title="API Errors" icon="triangle-exclamation" href="/api-reference/errors">
    Troubleshoot common API errors
  </Card>

  <Card title="Support Team" icon="headset" href="mailto:hello@notchpay.co">
    Contact our technical support team
  </Card>

  <Card title="Developer Community" icon="users" href="https://community.notchpay.co">
    Connect with other developers
  </Card>
</CardGroup>

<Callout type="success">
  Ready to start building? Check out our [Getting Started Guide](/get-started/index) to make your first API request.
</Callout>
