Skip to main content

Replace token

PUT/api/projects/{projectId}/sources/{sourceId}/token
Administrator

Read more: Connect a sourceSource: ProjectApiController#replaceToken(opens in new tab)

Path parameters​

NameTypeRequiredNotes
projectIdstring (uuid)Required
sourceIdstring (uuid)Required

Request body​

application/json

FieldTypeRequiredNotes
tokenstringRequiredmax 255 · pattern \\S*
accountEmailstringOptionalmax 255 · email

Response​

Success: 204

No response body.

Errors​

StatusCodeApplies to
400validation_faileda field is missing or out of rangeAny endpoint
400malformed_requestthe body cannot be readAny endpoint
400invalid_parametera path or query parameter is missing or does not convert, such as an ID that is not a UUIDAny endpoint
401authentication_requiredno sessionAny endpoint
403access_deniedan administrator endpoint, or a missing or stale CSRF tokenAny endpoint
404not_foundno such addressAny endpoint
405method_not_allowedthe address does not take that methodAny endpoint
415unsupported_media_typethe address does not read a body of that typeAny endpoint
500internal_errora fault ReleaseFlow did not foresee; the body never carries the exception behind itAny endpoint
400gitlab_base_url_invalidSources area
400gitlab_host_not_allowedSources area
400jira_site_invalidSources area
400github_token_rejectedSources area
400gitlab_token_rejectedSources area
400linear_token_rejectedSources area
400jira_token_rejectedSources area
400source_credential_requiredSources area
400source_signing_token_invalidSources area
404project_not_foundSources area
404source_not_foundSources area
409github_repository_already_connectedSources area
409gitlab_project_already_connectedSources area
409linear_team_already_connectedSources area
409jira_project_already_connectedSources area
409source_token_missingSources area
409source_sync_in_progressSources area
409source_import_not_supportedSources area
409source_import_not_resumableSources area
409source_disconnectedSources area
409source_not_disconnectedSources area
409source_reconnect_requiredSources area
409source_has_no_webhookSources area
409source_secret_generatedSources area
409source_secret_pastedSources area
503github_unavailableSources area
503gitlab_unavailableSources area
503jira_unavailableSources area

Request

bash
# Sign in first and keep the session cookie in cookies.txt (see Sessions and CSRF).
# CSRF_HEADER and CSRF_TOKEN are the headerName and token GET /api/csrf returned.
curl -X PUT "http://localhost:8080/api/projects/$PROJECT_ID/sources/$SOURCE_ID/token" \
-b cookies.txt -c cookies.txt \
-H "$CSRF_HEADER: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"token": "<string>",
"accountEmail": "<string>"
}'

The request body is an example built from the schema; replace every placeholder.

Response

204

No response body.