---
# @generated by sylphx-gen. Do not edit.
title: "Open git hub pull request on a trust policy"
description: "`broker.trust_policies.open_git_hub_pull_request` (POST /v1/{name}:openGitHubPullRequest): Opens a pull request as the user authorized by the policy's GitHub user Connection."
type: reference
product: platform
summary: "Opens a pull request as the user authorized by the policy's GitHub user Connection."
updated: 2026-09-28
nav: false
---

Opens a pull request as the user authorized by the policy's GitHub user Connection. Credentials remain inside Broker. Requires an exact repository, policy subject and actor, and pull_requests=write. Fork heads are refused.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/trust_policies/trust-policy:openGitHubPullRequest`
- **Scope** `broker:github:pull_requests:create`
- **Effect** `write` — a successful call changes state.
- **Collection** [trust_policies](/docs/api/trust_policies)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | Policy authorizing this action, not an installation-token exchange. Required. |
| `repository` | `string` | One exact owner/name from the policy's repository list. Required. |
| `head` | `string` | Existing branch in repository. Cross-fork owner:branch syntax is refused. Required. |
| `base` | `string` | Existing target branch in repository. Required. |
| `title` | `string` | Pull request title. Required. |
| `body` | `string` | Pull request description. |
| `draft` | `bool` | Whether to create a draft. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `number` | `int64` | Repository-local pull request number. |
| `html_url` | `string` | Public GitHub pull request URL. |
| `head` | `GitHubPullRequestHead` | Resolved source revision. |

### GitHubPullRequestHead

| Field | Type | What it is |
| --- | --- | --- |
| `sha` | `string` | Full Git object id returned by GitHub. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.
- [`RATE_LIMITED`](/docs/api/errors/RATE_LIMITED) — The rate limit is reached; see Retry-After.
- [`UNAVAILABLE`](/docs/api/errors/UNAVAILABLE) — The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.
- [`IDEMPOTENCY_KEY_REUSED`](/docs/api/errors/IDEMPOTENCY_KEY_REUSED) — An Idempotency-Key was reused with another body.
- [`IDEMPOTENCY_IN_PROGRESS`](/docs/api/errors/IDEMPOTENCY_IN_PROGRESS) — The first call with this Idempotency-Key is still running.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/trust_policies/trust-policy:openGitHubPullRequest" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"base":"…","head":"…","repository":"…","title":"…"}'
```

**TypeScript**

```ts
const response = await sylphx.broker.trustPolicies.openGitHubPullRequest({ base: '…', head: '…', name: 'orgs/acme/trust_policies/trust-policy', repository: '…', title: '…' })
```

**Rust**

```rust
let mut req = sylphx::broker::OpenGitHubPullRequestRequest::default();
req.base = "…".to_string();
req.head = "…".to_string();
req.name = "orgs/acme/trust_policies/trust-policy".to_string();
req.repository = "…".to_string();
req.title = "…".to_string();
let response = sx.broker().trust_policies().open_git_hub_pull_request(req).await?;
```

**CLI**

```bash
sylphx broker trust-policies open-git-hub-pull-request orgs/acme/trust_policies/trust-policy
```

**MCP**

```json
{ "method_id": "broker.trust_policies.open_git_hub_pull_request", "args": {"base":"…","head":"…","name":"orgs/acme/trust_policies/trust-policy","repository":"…","title":"…"} }
```
