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

# Parse Context URL

> Parses a context URL and returns the parsed result.

`Unary` · [`Runners`](https://ona.com/docs/api-reference/generated/runner/overview)

Parses a context URL and returns the parsed result.

Use this method to:

* Validate context URLs
* Check repository access
* Verify branch existence

Returns:

* FAILED\_PRECONDITION if authentication is required
* PERMISSION\_DENIED if access is not allowed
* INVALID\_ARGUMENT if URL is invalid
* NOT\_FOUND if repository/branch doesn't exist

### Examples

* Parse URL:

  Parses and validates a context URL.

  ```yaml theme={null}
  contextUrl: "https://github.com/org/repo/tree/main"
  ```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.RunnerService/ParseContextURL
```

Send a Bearer token as described in [Authentication](https://ona.com/docs/api-reference.md#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

```bash cURL theme={null}
export ONA_HOST=https://app.ona.com
export ONA_API_KEY=<your-token>

curl --request POST \
  --url "$ONA_HOST/api/gitpod.v1.RunnerService/ParseContextURL" \
  --header "Authorization: Bearer $ONA_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "runnerId": "<runner-id>"
}'
```

```python Python theme={null}
import gitpod.v1.runner_pb2 as runner_pb2
from ona_sdk import create_client_from_env

ona = create_client_from_env()
request = runner_pb2.ParseContextURLRequest(
    runner_id="<runner-id>",
)
response = ona.services.runner.parse_context_url(request)
print(response)
```

```typescript TypeScript theme={null}
import { create } from "@bufbuild/protobuf";
import { createClientFromEnv } from "@gitpod/sdk";
import { ParseContextURLRequestSchema } from "@gitpod/sdk/gitpod/v1/runner_pb";

async function main() {
  const ona = createClientFromEnv();
  const request = create(ParseContextURLRequestSchema, {
    runnerId: "<runner-id>",
  });
  const response = await ona.services.runner.parseContextURL(request);
  console.log(response);
}

main().catch(console.error);
```

```go Go theme={null}
package main

import (
	"context"
	"fmt"
	"log"

	"connectrpc.com/connect"
	"github.com/gitpod-io/gitpod-sdk-go/sdk"
	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
)

func main() {
	ona, err := sdk.NewFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	request := connect.NewRequest(&gitpodpb.ParseContextURLRequest{
		RunnerId: "<runner-id>",
	})
	response, err := ona.Services.Runner.ParseContextURL(context.Background(), request)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(response.Msg)
}
```

```json Request body theme={null}
{
  "runnerId": "<runner-id>"
}
```

## Request

`gitpod.v1.ParseContextURLRequest`

| Field | Type | Required | Description |
| - | - | - | - |
| `runnerId` | string | No | Constraints: `ignore=1, string.uuid=true`. |
| `contextUrl` | string | No | Constraints: `string.uri=true`. |

## Response

`gitpod.v1.ParseContextURLResponse`

| Field | Type | Required | Description |
| - | - | - | - |
| `originalContextUrl` | string | No | |
| `git` | [GitContext](#type-gitpod-v1-parse-context-url-response-git-context) | No | |
| `pr` | [PullRequest](#type-gitpod-v1-parse-context-url-response-pull-request) | No | **Deprecated.** |
| `issue` | [Issue](#type-gitpod-v1-parse-context-url-response-issue) | No | |
| `pullRequest` | [PullRequest](#type-gitpod-v1-pull-request) | No | |
| `projectIds` | array of string | No | project\_ids is a list of projects to which the context URL belongs to. |
| `scmId` | string | No | scm\_id is the unique identifier of the SCM provider (e.g., "github", "gitlab", "bitbucket") |
| `recommendedEnvironmentClasses` | array of string | No | recommended\_environment\_classes is an ordered list of environment class IDs that are suitable for creating an environment for this context URL. |

## Related types

> [accordion] GitContext
>
> `gitpod.v1.ParseContextURLResponse.GitContext`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `cloneUrl` | string | No | |
> | `branch` | string | No | |
> | `commit` | string | No | |
> | `host` | string | No | |
> | `owner` | string | No | |
> | `repo` | string | No | |
> | `upstreamRemoteUrl` | string | No | |
> | `tag` | string | No | |

> [accordion] Issue
>
> `gitpod.v1.ParseContextURLResponse.Issue`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `id` | string | No | id is the source system's ID of this issue, e.g. BNFRD-6100 |
> | `title` | string | No | |

> [accordion] PullRequest
>
> Deprecated: Use top-level PullRequest message instead
>
> `gitpod.v1.ParseContextURLResponse.PullRequest`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `id` | string | No | |
> | `title` | string | No | |
> | `fromBranch` | string | No | |
> | `toBranch` | string | No | |

> [accordion] PullRequest
>
> PullRequest represents pull request metadata from source control systems.
> This message is used across workflow triggers, executions, and agent contexts
> to maintain consistent PR information throughout the system.
>
> `gitpod.v1.PullRequest`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `id` | string | No | Unique identifier from the source system (e.g., "123" for GitHub PR #123) |
> | `title` | string | No | Pull request title |
> | `fromBranch` | string | No | Source branch name (the branch being merged from) |
> | `toBranch` | string | No | Target branch name (the branch being merged into) |
> | `url` | string | No | Pull request URL (e.g., "[https://github.com/owner/repo/pull/123](https://github.com/owner/repo/pull/123)") |
> | `author` | string | No | Author name as provided by the SCM system |
> | `repository` | [Repository](#type-gitpod-v1-pull-request-repository) | No | |
> | `draft` | boolean | No | Whether this is a draft pull request |
> | `state` | [State](#enum-gitpod-v1-pull-request-state) | No | |
> | `headSha` | string | No | Current revision identity for the PR head commit. Used internally for workflow execution deduplication and excluded from customer SDKs. |

> [accordion] Repository
>
> Repository information
>
> `gitpod.v1.PullRequest.Repository`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `cloneUrl` | string | No | |
> | `host` | string | No | |
> | `owner` | string | No | |
> | `name` | string | No | |

> [accordion] State
>
> Current state of the pull request
>
> | Value | Number | Description |
> | - | -: | - |
> | `STATE_UNSPECIFIED` | 0 | |
> | `STATE_OPEN` | 1 | |
> | `STATE_CLOSED` | 2 | |
> | `STATE_MERGED` | 3 | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.