Skip to content

Transfer Resource

POST
/organizations/{slug}/transfer-resource
curl --request POST \
--url https://api.mengi.cloud/organizations/example/transfer-resource \
--header 'Content-Type: application/json' \
--data '{ "resource_type": "example", "resource_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Transfer a cluster or a cloud/DNS credential to this organization.

The caller must be an ADMIN/OWNER of both the resource’s current organization and the target organization. Transferring a cluster cascades to everything it owns (deployments, databases, and their secrets) so the org-inheritance invariant is preserved.

Deployments, databases and secrets are not transferred on their own: that would only change the row’s organization while the workload keeps running on (and its secrets stay in) the old organization. They get a 400 that points to the route that moves them properly. The check depends on the request body only and runs before any lookup, so it discloses nothing.

The target org is addressed by slug and checked next, like every other /{slug} endpoint here (404 if missing, 403 if not an ADMIN member). The resource is addressed by id and follows require_resource: a caller with no relationship to it gets the same 404 as for a missing id, so its existence is not disclosed; a member of its org below ADMIN gets 403.

slug
required
Slug
string
Media typeapplication/json
TransferResourceRequest
object
resource_type
required
Resource Type
string
/^(cluster|deployment|secret|database|cloud_credential|dns_credential)$/
resource_id
required
Resource Id
string format: uuid

Example generated

{
"resource_type": "example",
"resource_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Successful Response

Media typeapplication/json

Example generated

example

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Example generated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}