---
title: "Upsert workspace agent port share"
method: POST
path: "/api/v2/workspaces/{workspace}/port-share"
tags: ["PortSharing"]
---

# Upsert workspace agent port share

`POST /api/v2/workspaces/{workspace}/port-share`

## Path parameters

- `workspace` string, uuid, required

## Request body

- CodersdkUpsertWorkspaceAgentPortShareRequest
  - `agent_name` string
  - `port` integer
  - `protocol` 'http' | 'https'
  - `share_level` 'owner' | 'authenticated' | 'organization' | 'public'

## Response `200`

OK

- CodersdkWorkspaceAgentPortShare
  - `agent_name` string
  - `port` integer
  - `protocol` 'http' | 'https'
  - `share_level` 'owner' | 'authenticated' | 'organization' | 'public'
  - `workspace_id` string, uuid

---

[API](https://skmtc.dev/coder/apis/coder-api.md) · [All operations](https://skmtc.dev/coder/apis/coder-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/coder/coder-api/revisions/369ae60ab00e/schema)
