Update the authorization_token of a Git repository resource. Only the credential can be updated; url, mount_path, and checkout cannot be changed.
Prerequisites
Complete the endpoint and authentication configuration. See API overview and authentication. The session must already have a Git repository mounted.
Endpoint
POST /sessions/{session_id}/resources/{resource_id}
Path parameters
session_id string (required)
Session ID in the format sesn_<ULID>.
resource_id string (required)
Git repository resource ID in the format sesrsc_<ULID>.
Request body
authorization_token string (required)
The new access token or password. It cannot be an empty string. You can omit the credential for a public repository when creating the session; this API only replaces an existing token.
The API accepts only
authorization_token. If you include url, mount_path, checkout, or other fields, the request returns 400 invalid_parameter.Request example
curl
Response fields
id string
Resource ID in the format sesrsc_<ULID>.
type string
Fixed to git_repository.
url string
The HTTPS URL of the Git repository. It does not contain credentials.
mount_path string
The actual mount path of the repository in the session sandbox.
checkout object / null
The checkout target specified at creation. It contains type and name for a branch, or sha for a commit. It is null when omitted.
created_at / updated_at string
Resource creation and last update time in ISO 8601. updated_at changes after the credential is updated.
request_id string
Unique identifier of the request.
Response example
Error codes
| Status code | Error code | Description |
|---|---|---|
| 400 | invalid_parameter | authorization_token is empty or invalid; the message is Invalid authorization_token |
| 400 | invalid_parameter | A field that cannot be updated is included; the message is Only authorization_token can be updated |
| 404 | not_found | The session or resource does not exist |
| 401 | InvalidApiKey | The API key is invalid |