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

# SDKs & libraries

> Client libraries and tools for working with the Propal API.

The Propal API uses standard REST conventions, so you can call it from any language with an HTTP client. Below are recommended approaches for common languages.

## Official API

The Propal API follows the [OpenAPI 3.0 specification](https://api.propal.io/v1/openapi.json). You can use this spec to generate a typed client in any language.

<Tip>
  Import the OpenAPI spec into tools like [Postman](https://www.postman.com/), [Insomnia](https://insomnia.rest/), or [Bruno](https://www.usebruno.com/) to explore the API interactively.
</Tip>

## Code examples

### Node.js / TypeScript

Use the built-in `fetch` API (Node 18+) or any HTTP client:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const PROPAL_API_KEY = process.env.PROPAL_API_KEY;

async function propal(path: string, options?: RequestInit) {
  const response = await fetch(`https://api.propal.io/v1${path}`, {
    ...options,
    headers: {
      Authorization: `Bearer ${PROPAL_API_KEY}`,
      "Content-Type": "application/json",
      ...options?.headers,
    },
  });

  if (!response.ok) {
    const { error } = await response.json();
    throw new Error(`Propal API error: ${error.message}`);
  }

  return response.json();
}

// List proposals
const { data } = await propal("/proposals?limit=10");
```

### Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
import requests

PROPAL_API_KEY = os.environ["PROPAL_API_KEY"]
BASE_URL = "https://api.propal.io/v1"

def propal(path, method="GET", json=None):
    response = requests.request(
        method,
        f"{BASE_URL}{path}",
        headers={"Authorization": f"Bearer {PROPAL_API_KEY}"},
        json=json,
    )
    response.raise_for_status()
    return response.json()

# List proposals
data = propal("/proposals?limit=10")
```

### cURL

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export PROPAL_API_KEY="pp_live_YOUR_KEY"

# List proposals
curl https://api.propal.io/v1/proposals \
  -H "Authorization: Bearer $PROPAL_API_KEY"

# Create a lead
curl -X POST https://api.propal.io/v1/leads \
  -H "Authorization: Bearer $PROPAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme Corp", "email": "contact@acme.com"}'
```

## Generate a typed client

You can generate a typed SDK from the OpenAPI spec using open-source tools:

| Language   | Tool                                                                                 | Command                                                                          |
| ---------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| TypeScript | [openapi-typescript](https://github.com/openapi-ts/openapi-typescript)               | `npx openapi-typescript https://api.propal.io/v1/openapi.json -o propal.d.ts`    |
| Python     | [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) | `openapi-python-client generate --url https://api.propal.io/v1/openapi.json`     |
| Go         | [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen)                         | `oapi-codegen -package propal https://api.propal.io/v1/openapi.json > propal.go` |
| Any        | [OpenAPI Generator](https://openapi-generator.tech/)                                 | Supports 50+ languages                                                           |

<Note>
  These are community tools, not maintained by Propal. Generated clients are based on our OpenAPI spec and should work with any valid Propal API endpoint.
</Note>

## Postman collection

Import the OpenAPI spec directly into Postman:

<Steps>
  <Step title="Open Postman">
    Click **Import** in the top-left corner.
  </Step>

  <Step title="Paste the spec URL">
    Enter `https://api.propal.io/v1/openapi.json` and click **Import**.
  </Step>

  <Step title="Set your API key">
    In the collection settings, set the `Authorization` header to `Bearer pp_live_YOUR_KEY`.
  </Step>
</Steps>
