# Change one of the organization's Git providers

> Organization owners (`org.manage`). Absent fields stay; `ca_pem: null` removes the CA. A `url` on another host needs `client_secret` again (422 at `/client_secret`): the stored secret only goes to the host it was entered for; a changed host also disconnects every member (their tokens belong to the old host), and the workspaces' IDE pods pick up the new URL like any other template change (`workspaces.upgradePolicy`). The same URL rules and 409s as the create.

URL: https://docs.harthelm.dev/reference/api/git/update-org-git-provider/ · Harthelm v1.6.1

## PATCH /api/v1/orgs/{org}/git-providers/{id}

Operation `updateOrgGitProvider` · area `git` · credentials: the cookie `__Host-harthelm_session`, the header `Harthelm-Authorization` or `Authorization: Bearer`

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `org` | path | string, uuid | yes |  |
| `id` | path | OrgGitProviderID | yes | The provider's id in the organization (not its ref). |

### Request body

`application/json`, required: OrgGitProviderPatch.

- `name` (string)
- `url` (string)
- `client_id` (string)
- `client_secret` (string, password, write-only)
- `ca_pem` (string or null, write-only): null removes the CA.

### Responses

| Status | Description | Body |
|---|---|---|
| 200 | The provider. | `application/json`: OrgGitProvider |
| 400 | The request is malformed. | `application/problem+json`: Problem |
| 401 | No or invalid credentials. | `application/problem+json`: Problem |
| 403 | The caller may not do this, or a CSRF check failed. | `application/problem+json`: Problem |
| 404 | The resource does not exist or is not visible to the caller. | `application/problem+json`: Problem |
| 409 | The request conflicts with the current state; `type` names the conflict. | `application/problem+json`: Problem |
| 422 | The request is well-formed but invalid; `errors` points at the fields. | `application/problem+json`: Problem |

### Response body (200)

- `id` (OrgGitProviderID, required): A provider's id within its organization; its ref is `<id>-<ref suffix>`.
- `ref` (GitProviderIDValue, required): The provider id everywhere else (`/auth/git/{ref}`, `GET /git/providers`, git access, the proxy path).
- `org_id` (string, uuid, required)
- `kind` (string, required): One of `gitea`.
- `name` (string, required)
- `url` (string, required): Web URL of the provider (https).
- `client_id` (string, required)
- `client_secret_set` (boolean, required): The OAuth client secret is stored (it is never returned).
- `ca_set` (boolean, required): A CA (PEM) for the provider's HTTPS is stored.
- `redirect_uri` (string, required): Register this at the provider's OAuth2 application.
- `created_by` (UserRef): A user as member lists show them.
  - `id` (ID, required): Numeric resource id.
  - `name` (string, required)
  - `email` (string, required)
  - `picture_url` (string)
- `created_at` (string, date-time, required)
- `updated_at` (string, date-time, required)
- `retired_at` (string, date-time): Only with include_retired, on a retired provider.
