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

# Examples

> Practical examples for GET, POST, and runtime payment flows.

## GET request through SELAT

```ts theme={null}
import { RouterClient, createViemSigner } from "@selat-ai/router-client";

const signer = createViemSigner(process.env.X402_CLIENT_PRIVATE_KEY as `0x${string}`);

const client = new RouterClient({
  chain: "base",
  signer
});

const response = await client.fetch(
  "https://pro-api.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest?symbol=eth",
  { method: "GET" }
);

console.log(await response.text());
```

## POST request with body

```ts theme={null}
const response = await client.fetch("https://upstream.example.com/v1/jobs", {
  method: "POST",
  headers: {
    "content-type": "application/json"
  },
  body: JSON.stringify({
    query: "pricing"
  })
});
```

## Remote signer example

```ts theme={null}
import { RouterClient, createRemoteSigner } from "@selat-ai/router-client";

const signer = createRemoteSigner(
  process.env.SELAT_SIGNER_ADDRESS as `0x${string}`,
  async ({ address, typedData }) => {
    const response = await fetch(process.env.SELAT_SIGNER_API_URL as string, {
      method: "POST",
      headers: {
        "content-type": "application/json"
      },
      body: JSON.stringify({ address, typedData })
    });

    const json = await response.json() as { signature: `0x${string}` };
    return json.signature;
  }
);
```

## Environment variables

If you run the example script in `selat-sdk`, these variables map cleanly to the supported signer modes:

* `SELAT_CHAIN`
* `SELAT_TARGET_URL`
* `SELAT_SIGNER_MODE`
* `X402_CLIENT_PRIVATE_KEY`
* `SELAT_SIGNER_ADDRESS`
* `SELAT_SIGNER_API_URL`
