---
id: entity-hook-action-create
title: "Create an entity hook action"
description: "Create an action for an entity hook."
sidebar_label: "Create an entity hook action"
hide_title: true
hide_table_of_contents: true
api: eJztWetu2zYUfhWCGLCtUByntbtNQAdkQYe1BdqgSbEBcWDQ4rHFVSJVXuJqhv7t/15ne529wF5hOKRoyZclxpBuQNH8cCyal+98/M6F1IpyMJkWlRVK0pSeaWAWCJOEZdhE5krjE0grbE1ypd4OaEItWxiaXtGnXTO9TqiqQDMc9ozTlIYxU/xxGmZLMz89TaiBzGlha5peregMmAZ96mxO06vr5jqhGt45MPY7xWuarmimpAVp8SurqkJkfpHjnw1iXlGT5VAy/GbrCmhK1exnyCwN8wgNHLFKLWnSgqIJDYhoQpc54D8/NKFKoiGVRlOsAIOz4shucmO1kAuabDF3SjQY5XQGRHBcZS5Aky9evn75JTEVZGJeC7kgyxw0EJsLExn2FoFBWuE9K6vCW6AXTIpfvJ1PTlKWZcpJ++RhKlkJpmIZPHmU9rh4MqLN2rg7sV7mQLAHUfO4s2w+h8wCJ7M6oOvteIvUI5SuRDJ7S+NuZsqTx6EqVF3iViV0jRQJ7SwLfZv1BhwENhAosshZrRxZMmmJVWQGRCpPNydsppzt4+wQddrrtS212G7iUECQKALtKdY/xgHhad23R0c3ot8Yx/Xb1qPXTHVju6Y4smtpx+2yGoc3CeWiBGmEkmafW2wS/ALqoxtWOCAVE9oQDnMhUasWmceJUSf40NNBXHlFQd4IraTf9RQ9h7voWl60uqYpdYY2Tetre3Y8btcM5kp7nuYWNJq4CfUi6AAM+pHNQXtYXqMqy5w2JMxAMGrhFES6oqgKZudKl58bIqQFLVlBCrUQ2WAiN7yuXb5po8EtQGPEu9Ov+v4zkRP5LXnw4KWykD54QM6c1iBtUSdEyaImEz/thBJhiHFVpbQFvo3Rr9z4QHULvrWQXMWj6qNq/olS20Pf+pnNmSVWi8UCtFlzvRmqouiQNWF9U7D9Bwz861/xdw2mUtKEqPpwOMR/uwy2ay+ZiUsDJ8ZlGRgzd0VRD7y07iElC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qyd286UxdqJJ++X7eDfy/MdLf8xCJ3zdvRF42iVeXwL9m7Kku1xYn/bjAX77pLx59jz4eBgPJN25I1qPmT7U2L36Vsi5wvmR8wDjZDAcDGlXJ/TftfiC2NiS+eAUCqzeu5vd88G29HrvVA5+5xPgW3hvj6uCCYkovDJWrZKu+q98OkavE5qj4NIrulrNmIE3umgabH7nAPm6uk7oDdMCvcy/AUpoDoyD9uJ7C0jpWYB7dBlu2vwBH88A27G6SeKI0yyDyt7a97rnE+evLi5Rgu0rp9LHQ6rZEmM8W9KU4qZV6yrTt61oweTCeWenYU4ULNvU+5a+vVXxDCPrHsLVKvS4VG9BNg1NWlMsPtPmummavwGuOqPh
sidebar_class_name: "post api-method"
info_path: docs/api/entity-hook
custom_edit_url: null
---

import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";

<Heading
  as={"h1"}
  className={"openapi__heading"}
  children={"Create an entity hook action"}
>
</Heading>

<MethodEndpoint
  method={"post"}
  path={"/entity_hook/action"}
  context={"endpoint"}
>
  
</MethodEndpoint>



Create an action for an entity hook.

<Heading
  id={"request"}
  as={"h2"}
  className={"openapi-tabs__heading"}
  children={"Request"}
>
</Heading>

<ParamsDetails
  parameters={undefined}
>
  
</ParamsDetails>

<RequestSchema
  title={"Body"}
  body={{"content":{"application/json":{"schema":{"type":"object","required":["nrn","entity","action","when","type","on"],"properties":{"nrn":{"type":"string","description":"A resource identifier (NRN) specifying where this action applies.","example":"organization=1:account=2:namespace=3:application=4"},"entity":{"type":"string","description":"The type of entity affected by this entity hook action.","enum":["application","scope","deployment","namespace"],"example":"scope"},"action":{"type":"string","description":"The specific action you want to be notified about.","enum":["deployment:create","deployment:write","deployment:delete","scope:create","scope:write","scope:delete","application:create","application:write","application:delete","namespace:create","namespace:write","namespace:delete"],"example":"scope:create"},"dimensions":{"type":"object","description":"Key-value pairs defining the scope of the action.","example":{"environment":"production","country":"us"}},"when":{"type":"string","enum":["before","after"],"description":"Specifies whether the hook occurs before or after nullplatform's internal logic.\n","example":"before"},"type":{"type":"string","enum":["hook"],"description":"The type of entity hook action.\n\n> **Note:** Currently, only \"hook\" is supported.\n","example":"hook"},"on":{"type":"string","enum":["create","update","delete"],"description":"Specifies the type of action that triggers the hook.","example":"create"}},"title":"entityHook_create"}}}}}
>
  
</RequestSchema>

<StatusCodes
  id={undefined}
  label={undefined}
  responses={{"200":{"description":"The action was triggered successfully.","content":{"application/json":{"schema":{"type":"object","required":["id","nrn","entity","action","on_policy_success","on_policy_fail","when","type","on"],"properties":{"id":{"type":"string","format":"uuid","description":"The unique identifier of the entity hook.","example":"550e8400-e29b-41d4-a716-446655440000"},"nrn":{"type":"string","description":"A resource identifier (NRN) specifying where this action applies.","example":"organization=1:account=2:namespace=3:application=4"},"entity":{"type":"string","description":"The type of entity affected by this entity hook action.","enum":["application","scope","deployment","namespace"],"example":"scope"},"action":{"type":"string","description":"The specific action you want to be notified about.","enum":["deployment:create","deployment:write","deployment:delete","scope:create","scope:write","scope:delete","application:create","application:write","application:delete","namespace:create","namespace:write","namespace:delete"],"example":"scope:create"},"dimensions":{"type":"object","description":"Key-value pairs defining the scope of the action.","example":{"environment":"production","country":"us"}},"on_policy_success":{"type":"string","enum":["manual"],"description":"The action to be taken on the entity hook success.\n\n> **Note:** Currently, only \"manual\" is supported.\n","example":"manual"},"on_policy_fail":{"type":"string","enum":["manual"],"description":"The action to be taken on entity hook failure.\"\n\n  > **Note:** Currently, only \"manual\" is supported.\n","example":"manual"},"when":{"type":"string","enum":["before","after"],"description":"Specifies whether the hook occurs before or after nullplatform's internal logic.\n","example":"before"},"type":{"type":"string","enum":["hook"],"description":"The type of entity hook action.\n\n> **Note:** Currently, only \"hook\" is supported.\n","example":"hook"},"on":{"type":"string","enum":["create","update","delete"],"description":"Specifies the type of action that triggers the hook.","example":"create"},"policies":{"type":"array","description":"The policies applied to the entity.\n\n> ℹ️ If no policies are found, we return an empty array.\n","items":{"type":"object","properties":{"id":{"type":"integer","description":"A unique identifier for the policy.","example":5678},"nrn":{"type":"string","description":"A resource identifier (NRN) specifying where the policy applies.","example":"organization=1:account=2:namespace=3:application=4"},"name":{"type":"string","description":"The name of the policy.","example":"Crypto Kong Policies"},"conditions":{"type":"object","description":"A JSON object defining the conditions under which this policy applies.","example":{"scope.requested_spec.memory_in_gb":{"$lte":4}}}}}}},"title":"entityHook"}}}},"4XX":{"description":"Client error responses due to invalid input or missing parameters.","content":{"application/json":{"schema":{"type":"object","required":["statusCode","error","message"],"properties":{"statusCode":{"type":"integer","description":"HTTP status code representing the specific client error (e.g., 400, 401, 403, 404).","example":400},"code":{"type":"string","description":"A machine-readable error code that categorizes the server failure.","example":"bad_request"},"error":{"type":"string","description":"A brief, human-readable description of the error type (e.g., \"Bad Request\", \"Unauthorized\").","example":"Bad Request"},"message":{"type":"string","description":"Additional details about the error.","example":"The request was malformed or contained invalid parameters."}}}}}},"5XX":{"description":"Server error responses indicating an issue on the API side.","content":{"application/json":{"schema":{"type":"object","required":["statusCode","error","message"],"properties":{"statusCode":{"type":"integer","description":"HTTP status code representing the specific server error (e.g., 500, 502, 503).","example":500},"code":{"type":"string","description":"A machine-readable error code that categorizes the server failure.","example":"internal_server_error"},"error":{"type":"string","description":"A brief, human-readable description of the error type (e.g., \"Internal Server Error\", \"Service Unavailable\").","example":"Internal Server Error"},"message":{"type":"string","description":"Additional details about the error.","example":"An unexpected error occurred. Please try again later."}}}}}}}}
>
  
</StatusCodes>


      