Proxy Hooks let you attach MITM-style intercept scripts to specific paths on a container service. Hooks are evaluated per-service in position order, first-match-wins. All mutating operations are ETag-gated via the If-Match: file:v header to prevent lost updates.
GET /api/v1/containers/{id}/proxy/hooks
Returns every hook for the container grouped by service, alongside the current file_version and ETag.
Name In Type Required Description idpath string Yes Container ID
"message" : " Proxy hooks listed successfully " ,
"id" : " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"groups" : [ " admins " , " sre " ]
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
const { data } = await client . api . proxyHooks . listContainerProxyHooks ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
GET /api/v1/containers/{id}/proxy/hooks/{service}
Returns the ordered hook array for a single service. Within the list, evaluation is first-match-wins by position order.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name
"message" : " Service hooks listed successfully " ,
"id" : " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"method" : [ " POST " , " PUT " ],
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"groups" : [ " admins " , " sre " ]
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
const { data } = await client . api . proxyHooks . listContainerProxyServiceHooks ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
GET /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}
Returns the hook identified by hookId under the given service.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name hookIdpath string Yes 26-char Crockford base32 ULID (lowercase)
"message" : " Hook retrieved successfully " ,
"id" : " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
const { data } = await client . api . proxyHooks . getContainerProxyHook ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
hookId: " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
POST /api/v1/containers/{id}/proxy/hooks/{service}
Creates a new hook under the given service. Omit position to append; supply a 0-indexed position to insert. Requires If-Match: file:v.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name if-matchheader string No file:v<N> ETag precondition
Field Type Required Description matchobject Yes Request matcher. Contains method (string or array of strings from *, GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS), path (string, max 257 chars), and headers (object of string values). scriptobject Yes Script reference. path is required; optionally subdomain and execId. timeoutinteger No Execution timeout in ms (1–30000). applies_toobject No Restriction object. groups is an array of group name strings (min 1). positioninteger No 0-indexed insertion position (POST only).
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"message" : " Hook created successfully " ,
"id" : " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
"error" : " Precondition Failed " ,
"message" : " etag_mismatch "
"error" : " Validation Error " ,
"message" : " Invalid hook "
"error" : " Precondition Required " ,
"message" : " If-Match header required for this operation "
const { data } = await client . api . proxyHooks . addContainerProxyHook ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
match: { method: " POST " , path: " /v1/login " },
script: { path: " /hooks/login-trace.js " },
PATCH /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}
Full-replaces the hook at the given id, preserving its id and position. Requires If-Match.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name hookIdpath string Yes 26-char Crockford base32 ULID (lowercase) if-matchheader string No file:v<N> ETag precondition
Field Type Required Description matchobject Yes Request matcher. Contains method (string or array of strings from *, GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS), path (string, max 257 chars), and headers (object of string values). scriptobject Yes Script reference. path is required; optionally subdomain and execId. timeoutinteger No Execution timeout in ms (1–30000). applies_toobject No Restriction object. groups is an array of group name strings (min 1). positioninteger No 0-indexed insertion position (POST only).
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"message" : " Hook updated successfully " ,
"id" : " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
"error" : " Precondition Failed " ,
"message" : " etag_mismatch "
"error" : " Validation Error " ,
"message" : " Invalid hook "
"error" : " Precondition Required " ,
"message" : " If-Match header required for this operation "
const { data } = await client . api . proxyHooks . updateContainerProxyHook ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
hookId: " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
match: { method: " POST " , path: " /v1/login " },
script: { path: " /hooks/login-trace.js " },
PATCH /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}/position
Atomically reorders a single hook. Body must contain the target position. Requires If-Match.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name hookIdpath string Yes 26-char Crockford base32 ULID (lowercase) if-matchheader string No file:v<N> ETag precondition
Field Type Required Description positioninteger Yes 0-indexed target position.
"message" : " Hook moved successfully " ,
"id" : " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"execId" : " exec_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
"path" : " /hooks/login-trace.js "
"groups" : [ " admins " , " sre " ]
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
"error" : " Precondition Failed " ,
"message" : " etag_mismatch "
"error" : " Precondition Required " ,
"message" : " If-Match header required for this operation "
const { data } = await client . api . proxyHooks . moveContainerProxyHook ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
hookId: " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,
DELETE /api/v1/containers/{id}/proxy/hooks/{service}
Removes every hook under the given service. Requires If-Match.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name if-matchheader string No file:v<N> ETag precondition
"message" : " Service hooks cleared " ,
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
"error" : " Precondition Failed " ,
"message" : " etag_mismatch "
"error" : " Precondition Required " ,
"message" : " If-Match header required for this operation "
const { data } = await client . api . proxyHooks . clearContainerProxyServiceHooks ( {
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
DELETE /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}
Deletes a single hook by id. Requires If-Match.
Name In Type Required Description idpath string Yes Container ID servicepath string Yes Service name hookIdpath string Yes 26-char Crockford base32 ULID (lowercase) if-matchheader string No file:v<N> ETag precondition
"message" : " Hook removed successfully " ,
"message" : " Resource not found "
Error Code Title Description Resolution NOT_FOUNDHook or service not found The hook id, service, or container does not exist, or the service is reject-listed Verify the service name is not reject-listed (logs, proxy, workspaces) and that the hook id exists VALIDATION_ERRORValidation error Request body violates hook schema, caps, or referential integrity Check error details and correct the body shape; ensure applies_to.groups references defined groups PRECONDITION_REQUIREDIf-Match required Destructive writes require an If-Match: file:v<N> header Fetch the resource first to obtain the ETag and resend with If-Match PRECONDITION_FAILEDETag mismatch The If-Match header does not match the current file_version Re-fetch the resource to get the current ETag and retry
"error" : " Precondition Failed " ,
"message" : " etag_mismatch "
"error" : " Precondition Required " ,
"message" : " If-Match header required for this operation "
await client . api . proxyHooks . removeContainerProxyHook ({
id: " container_01hz8x9k2b3c4d5e6f7g8h9j0k " ,
hookId: " 01hz8x9k2b3c4d5e6f7g8h9j0k " ,