> For the complete documentation index, see [llms.txt](https://docs.aftermath.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aftermath.finance/for-developers/typescript-sdk/utils/authorization.md).

# Authorization

A system for obtaining and managing increased API rate limits through request authorization.

### Initialization

```typescript
const afSdk = new Aftermath("MAINNET");
await afSdk.init(); // initialize provider

const auth = afSdk.Auth();
```

### Rate Limits

Default rate limit: 1000 requests per 10 seconds.

To request increased limits:

1. Visit [Aftermath Discord](https://discord.com/invite/KvVCAauXk5)
2. Open a ticket with:

```
sui-address: <your-sui-address>
rate-limit-requests: [<sdk-call>: <desired-rate-limit>]
```

### Methods

#### Initialize with Private Key

```typescript
const keypair = Helpers.keypairFromPrivateKey("your-private-key");

const stopAuth = await auth.init({
	signMessageCallback: async ({ message }) => {
		const { signature } = await keypair.signPersonalMessage(message);
		return { signature };
	},
	walletAddress: keypair.toSuiAddress(),
});

// Make authorized requests
const pools = await afSdk.Pools().getAllPools();

// Stop authorization
stopAuth();
```

### Types

```typescript
interface AuthInitOptions {
	signMessageCallback: (args: { message: Uint8Array }) => Promise<{
		signature: string;
	}>;
	walletAddress: string;
}
```

### Example Usage

```typescript
const afSdk = new Aftermath("MAINNET");
await afSdk.init();

// Initialize with private key
const keypair = Helpers.keypairFromPrivateKey("your-private-key");
const stopAuth = await afSdk.Auth().init({
	signMessageCallback: async ({ message }) => {
		const { signature } = await keypair.signPersonalMessage(message);
		return { signature };
	},
	walletAddress: keypair.toSuiAddress(),
});

// Make authorized requests
const pools = await afSdk.Pools().getAllPools();
const prices = await afSdk.Prices().getCoinPrice({
	coin: "0x2::sui::SUI",
});

// Clean up
stopAuth();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.aftermath.finance/for-developers/typescript-sdk/utils/authorization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
