Skip to content
Hoody.com

Register MITM hook scripts that intercept container traffic before it reaches the real service. Hooks are organized per-service with first-match-wins semantics, and all mutating operations are ETag-gated via the If-Match header. Use these endpoints to list, create, replace, reorder, and delete proxy hooks for a container.

GET /api/v1/containers/{id}/proxy/hooks

Returns all hooks grouped by service for the given container, with the current ETag.

NameInTypeRequiredDescription
idpathstringYesContainer ID
Terminal window
curl -X GET \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks \
-H "Authorization: Bearer $HOODY_TOKEN"

GET /api/v1/containers/{id}/proxy/hooks/{service}

Returns the ordered hook array for a single service. First-match-wins within this list.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
Terminal window
curl -X GET \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/api \
-H "Authorization: Bearer $HOODY_TOKEN"

GET /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}

Retrieves a single hook by its ULID within a specific service.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
hookIdpathstringYes26-char Crockford base32 ULID (lowercase)
Terminal window
curl -X GET \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/api/01h8x3kq7v4mz0qy6f3t8n2rxd \
-H "Authorization: Bearer $HOODY_TOKEN"

POST /api/v1/containers/{id}/proxy/hooks/{service}

Create a new hook under a service. Requires the If-Match: file:v<N> header. Omit position to append to the end of the service’s hook array.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
if-matchheaderstringYesfile:v<N> ETag precondition
NameTypeRequiredDescription
matchobjectYesMatch criteria for intercepting requests
match.methodstring or arrayNoHTTP method or array of methods (*, GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)
match.pathstringNoURL path pattern (max 257 chars)
match.headersobjectNoHeader key-value pairs to match
scriptobjectYesScript to execute when the hook matches
script.pathstringYesPath to the hook script
script.subdomainstringNoSubdomain for the script execution target
script.execIdstringNoExecution ID for the script
timeoutintegerNoTimeout in milliseconds (1-30000)
applies_toobjectNoGroup-based targeting
applies_to.groupsarrayNoArray of group names (min 1 item)
positionintegerNo0-indexed insertion position (omit to append)
Terminal window
curl -X POST \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/api \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "If-Match: file:v42" \
-H "Content-Type: application/json" \
-d '{
"match": {
"method": "DELETE",
"path": "/v1/projects/*"
},
"script": {
"path": "/hooks/audit-delete.js"
},
"timeout": 8000,
"applies_to": {
"groups": ["auditors"]
}
}'

PUT /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}

Full-replace a hook preserving its id and position. Requires the If-Match header. The same path also accepts PATCH as a live alias for this operation.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
hookIdpathstringYes26-char Crockford base32 ULID (lowercase)
if-matchheaderstringYesfile:v<N> ETag precondition
NameTypeRequiredDescription
matchobjectYesMatch criteria for intercepting requests
match.methodstring or arrayNoHTTP method or array of methods (*, GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)
match.pathstringNoURL path pattern (max 257 chars)
match.headersobjectNoHeader key-value pairs to match
scriptobjectYesScript to execute when the hook matches
script.pathstringYesPath to the hook script
script.subdomainstringNoSubdomain for the script execution target
script.execIdstringNoExecution ID for the script
timeoutintegerNoTimeout in milliseconds (1-30000)
applies_toobjectNoGroup-based targeting
applies_to.groupsarrayNoArray of group names (min 1 item)
positionintegerNo0-indexed insertion position (POST only)
Terminal window
curl -X PUT \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/api/01h8x3kq7v4mz0qy6f3t8n2rxd \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "If-Match: file:v42" \
-H "Content-Type: application/json" \
-d '{
"match": {
"method": "GET",
"path": "/v1/users/*",
"headers": {
"X-Internal": "true"
}
},
"script": {
"path": "/hooks/auth-check-v2.js",
"execId": "exec_def456"
},
"timeout": 7000
}'

PATCH /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}/position

Atomically move a hook to a new 0-indexed position within its service array. Requires the If-Match header.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
hookIdpathstringYes26-char Crockford base32 ULID (lowercase)
if-matchheaderstringYesfile:v<N> ETag precondition
NameTypeRequiredDescription
positionintegerYesNew 0-indexed position (minimum 0)
Terminal window
curl -X PATCH \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/api/01h8x3kq8w5n1rz7g4v9p3syfa/position \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "If-Match: file:v42" \
-H "Content-Type: application/json" \
-d '{
"position": 0
}'

DELETE /api/v1/containers/{id}/proxy/hooks/{service}

Delete every hook under the given service. Requires the If-Match header.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
if-matchheaderstringYesfile:v<N> ETag precondition
Terminal window
curl -X DELETE \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/logs \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "If-Match: file:v42"

DELETE /api/v1/containers/{id}/proxy/hooks/{service}/{hookId}

Delete a single hook by its ULID. Requires the If-Match header.

NameInTypeRequiredDescription
idpathstringYesContainer ID
servicepathstringYesService name
hookIdpathstringYes26-char Crockford base32 ULID (lowercase)
if-matchheaderstringYesfile:v<N> ETag precondition
Terminal window
curl -X DELETE \
https://api.hoody.com/api/v1/containers/890abcdef12345678901cdef/proxy/hooks/api/01h8x3kq7v4mz0qy6f3t8n2rxd \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "If-Match: file:v42"