Exchange Context Owned By Use Case
URI: https://docs.ankatech.co/errors/exchange-context-owned-by-use-case
HTTP Status: 409 Conflict
When you see this
The Exchange Context your request names belongs to an Internal Crypto Use Case. Nothing changed.
An Internal Crypto Use Case provisions its own Exchange Context together with its actor, credential, policy and grants, and governs all of them as one. Its context therefore admits only that use case's own grants, and is ended only by revoking the use case, which closes it as one of its steps. Every other write naming the context is refused:
| Operation | What it would have done |
|---|---|
closeExchangeContext | Ended the use case's authority while the use case still read as live |
createExchange | Created a Cryptographic Exchange in the use case's context |
updateExchange | Moved an Exchange into the use case's context |
cloneExchange | Cloned an Exchange that sits in the use case's context |
activateExchange | Activated an Exchange that sits in the use case's context |
createExchangeGrant, createCapabilityGrant | Added a grant to the use case's context |
previewCapabilityGrant | Described such a grant; the preview answers what the write would |
The ownership is checked after the context is found in your tenant and before its status, so the answer is the same whatever the context's status. Every Exchange Context read carries ownedByUseCaseId: the owning use case, or null for a context the tenant owns. Check it before you name a context.
The owning use case travels as the useCaseId extension member and in detail. It is a use case of your own tenant.
Common Causes
- Closing every context of a tenant from a script, including the ones use cases provisioned.
- Choosing a context named
ctx-<use-case-name>for a new Exchange or a standalone grant. - Cloning or activating an Exchange that an earlier configuration placed in a use case's context.
Response Example
{
"type": "https://docs.ankatech.co/errors/exchange-context-owned-by-use-case",
"title": "Exchange Context Owned By Use Case",
"status": 409,
"detail": "This Exchange Context is owned by internal crypto use case 3e8a1c52-7b4d-4f9e-a2c6-5d1b8f0e7a34 and ends only when that use case is revoked. Revoke the use case instead.",
"instance": "/api/v3/admin/tenants/7c9e6679-7425-40de-944b-e07fc1f90ae7/exchange-contexts/5a9d3e7f-1b2c-4d6e-8f0a-2c4e6a8b0d13/close",
"timestamp": 1730000000,
"extensions": {
"useCaseId": "3e8a1c52-7b4d-4f9e-a2c6-5d1b8f0e7a34",
"requestId": "550e8400-e29b-41d4-a716-446655440000"
}
}
Content-Type: application/problem+json, following RFC 9457 Problem Details.
How to Resolve
- Read
extensions.useCaseId. - For an Exchange or a grant, choose or create an Exchange Context the tenant owns (
ownedByUseCaseIdisnull). - To end the use case's authority, revoke the use case (
revokeInternalCryptoUseCase). The revoke revokes its grants and credential, disables its actor and closes its context, in one transaction. - To stop the use case only for a while, suspend it instead; its context stays as it is.
For full schema definitions, examples, and interactive testing, see the Developer Hub Reference.