# Connect author

URL: https://docs.hanzo.ai/docs/openapi/author/post-author-connect

> Enrols the caller's org in the author program at status "connected" and returns its enrolment, including the verify code the file method needs.

`POST /v1/author/connect`

> [Author →](https://docs.hanzo.ai/docs/openapi/author) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                          |
| ------------- | ---------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/author/connect` |
| **Method**    | `POST`                                   |
| **Operation** | `post_author_connect`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`   |

Enrols the caller's org in the author program at status "connected"
and returns its enrolment, including the verify code the file method needs. It is
IDEMPOTENT: a second call returns the same enrolment rather than a conflict.

The forge login is taken from IAM's LINKED account for the provider when there is
one — that is identity proof, not a claim — and only otherwise from the login in
the body, which then has to be proven per repository. Connecting does not admit an
org to earning: a platform reviewer approves that separately.

Answers 201 when it enrolled the org and 200 when it found an existing enrolment.

## Request

3 fields, body `application/json` (required).

| Field         | In   | Type   | Required | Description                                                                        |
| ------------- | ---- | ------ | -------- | ---------------------------------------------------------------------------------- |
| `githubLogin` | body | string | —        | GithubLogin is the account to link.                                                |
| `login`       | body | string | —        | Login is the provider-neutral alias for GithubLogin, preferred when both are sent. |
| `provider`    | body | string | —        | Provider is the forge to enrol with: github (the default) or gitlab.               |

## Response

| Status    | Body             | Meaning |
| --------- | ---------------- | ------- |
| `200`     | author.enrolment | ok      |
| `default` | problem-details  | refused |

`200` body — 9 fields.

| Field           | In   | Type            | Always | Description                                                                                         |
| --------------- | ---- | --------------- | ------ | --------------------------------------------------------------------------------------------------- |
| `created`       | body | boolean         | —      | Created reports whether this call enrolled the org (201) or found an existing enrolment (200).      |
| `githubLogin`   | body | string          | —      | GithubLogin is the linked forge account.                                                            |
| `id`            | body | string          | —      | ID is the author record's server-minted handle, "aut\_"-prefixed.                                   |
| `shareBps`      | body | integer (int64) | —      | ShareBps is this author's royalty share in basis points of the spend their deployed work generates. |
| `status`        | body | string          | —      | Status is connected, approved or suspended.                                                         |
| `verified`      | body | boolean         | —      | Verified reports whether any repository or owner claim has been proven yet.                         |
| `verifyCode`    | body | string          | —      | VerifyCode is this author's stable proof token — the value a repository's verify file must carry.   |
| `verifyFile`    | body | string          | —      | VerifyFile is the repo-root file the file method reads, on the default branch.                      |
| `verifySnippet` | body | string          | —      | VerifySnippet is that file's exact contents, ready to commit.                                       |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo author connect
```

**SDK**

**.ts**

```ts
import { Configuration, AuthorApi } from 'hanzoai';

const api = new AuthorApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAuthorConnect({ githubLogin: "<githubLogin>", login: "<login>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AuthorApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AuthorApi(client).post_author_connect(github_login="<githubLogin>", login="<login>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AuthorAPI.PostAuthorConnect(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, author_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = author_api::post_author_connect(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AuthorApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AuthorApi(client).postAuthorConnect();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/author/connect \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "githubLogin": "<githubLogin>",
       "login": "<login>"
     }'
```

**MCP**

MCP reaches **author** through the `author` tool, which names its 5 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_authors"
         }
       }
     }'
```

---

[Author API](https://docs.hanzo.ai/docs/openapi/author) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
