# The SDK

> The Git API from code, and webhook verification, with @sypnia/git.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://git.docs.sypnia.com/tools/sdk/

For agents: createClient({ token }) from '@sypnia/git/client': repos.get/create/list, branches.list/protect, pulls.create/get/merge/review, issues.create/list/linkCase, statuses.create, webhooks.create. verifyWebhook(body, headers, secret) from '@sypnia/git/webhooks' returns a typed event or throws.

```bash
npm install @sypnia/git
```

```ts
import { createClient } from '@sypnia/git/client';

const git = createClient({ token: process.env.SYPNIA_TOKEN });

const pr = await git.pulls.create('laespiga/web', {
  head: 'cancel-order', base: 'main',
  title: 'Customers can cancel until 10 am',
  body: 'Case: cancel-order',
});
await git.statuses.create('laespiga/web', pr.headSha, { state: 'success', context: 'ci/tests' });
```

```ts
import { verifyWebhook } from '@sypnia/git/webhooks';

const event = verifyWebhook(rawBody, headers, process.env.WEBHOOK_SECRET!);
if (event.type === 'pull_request' && event.action === 'closed' && event.pull_request.merged) {
  // …
}
```

Every method maps to one endpoint of the [API](https://git.docs.sypnia.com/api).
