> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/reference/frends-platform-api/platform-api-reference/api-policies.md).

# Api Policies

## GET /api/v1/api-policies

> List API policies

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"ApiPolicies"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/api-policies":{"get":{"tags":["ApiPolicies"],"summary":"List API policies","parameters":[{"name":"Filter","in":"query","description":"Filter is matched against name, description and endpoints associated with the policy.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseOfIEnumerableOfApiPolicyListItemViewModel"}}}}}}}},"components":{"schemas":{"ResponseOfIEnumerableOfApiPolicyListItemViewModel":{"required":["data"],"type":"object","properties":{"data":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyListItemViewModel"},"description":"Response data"}}},"ApiPolicyListItemViewModel":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the API policy","format":"int64"},"name":{"type":"string","description":"The name of the policy"},"description":{"type":["null","string"],"description":"The description of the policy"}}}}}}
```

## POST /api/v1/api-policies

> Create an API policy

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"ApiPolicies"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/api-policies":{"post":{"tags":["ApiPolicies"],"summary":"Create an API policy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPolicySaveModel"}}},"required":true},"responses":{"201":{"description":"Created","headers":{"Location":{"description":"Location of the created API policy","schema":{"type":"string"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ApiPolicySaveModel":{"required":["targetEndpoints","name"],"type":"object","properties":{"targetEndpoints":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyTargetEndpointSaveModel"},"description":"The list of target endpoints associated with the policy"},"identities":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyIdentitySaveModel"},"description":"The list of identities associated with the policy"},"apiKeyGroups":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupSaveModel"},"description":"The list of API key groups associated with the policy"},"publicAccessDeployments":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyDeploymentSaveModel"},"description":"The list of deployments associated with the public access identity"},"requestLoggingOptions":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyRequestLoggingSaveModel"},"description":"The list of request logging options associated with the api policy"},"name":{"type":"string","description":"The name of the policy"},"description":{"type":["null","string"],"description":"The description of the policy"},"tags":{"type":["null","array"],"items":{"type":"string"},"description":"The tags of the policy"},"allowPublicAccess":{"type":"boolean","description":"Determines if public access is allowed"},"apiKeyName":{"type":"string","description":"The name of the API key"},"apiKeyLocation":{"description":"The location of the API key","$ref":"#/components/schemas/ParameterLocation"}}},"ApiPolicyTargetEndpointSaveModel":{"required":["path"],"type":"object","properties":{"path":{"type":"string","description":"The path of the target endpoint"},"method":{"description":"The HTTP method of the target endpoint","$ref":"#/components/schemas/PolicyEndpointMethod"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"PolicyEndpointMethod":{"enum":["All","Get","Post","Put","Head","Delete","Patch","Options","Connect","Trace"]},"ApiPolicyIdentitySaveModel":{"required":["deployments","issuers","name"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The unique identifier of the identity. Only provide a value when updating.","format":"int64"},"identityRules":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyIdentityRuleSaveModel"},"description":"The list of identity rules"},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyDeploymentSaveModel"},"description":"The list of deployments associated with the identity"},"isPrivateApplication":{"type":"boolean","description":"Determines if it is a private application"},"issuers":{"description":"The issuers of the identity","$ref":"#/components/schemas/JsonArray"},"name":{"type":"string","description":"The name of the identity"},"throttlingByClaim":{"type":["null","string"],"description":"The throttling by claim for the identity"},"priorityNumber":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"In case of 2 or more matching identities, determines which identity to use. Lower number will be selected.","format":"int32"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"ApiPolicyIdentityRuleSaveModel":{"required":["claim"],"type":"object","properties":{"ruleType":{"description":"The type of access rule","$ref":"#/components/schemas/ApiAccessRuleType"},"claim":{"type":"string","description":"The claim associated with the identity rule"},"value":{"type":["null","string"],"description":"The value associated with the identity rule"},"matchType":{"description":"The match type of the identity rule","$ref":"#/components/schemas/IdentityRuleMatchType"}}},"ApiAccessRuleType":{"enum":["Allow","Deny"]},"IdentityRuleMatchType":{"enum":["Exact","Exists","Regex"]},"ApiPolicyDeploymentSaveModel":{"required":["agentGroupName"],"type":"object","properties":{"agentGroupName":{"type":"string","description":"The Agent Group associated with the deployment"}}},"JsonArray":{"type":"array"},"ApiPolicyApiKeyGroupSaveModel":{"required":["apiPolicyApiKeyGroupAssignments","name"],"type":"object","properties":{"apiPolicyApiKeyGroupAssignments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupAssignmentSaveModel"},"description":"The API key group assignments"},"name":{"type":"string","description":"The name of the API key group"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"ApiPolicyApiKeyGroupAssignmentSaveModel":{"required":["apiKey"],"type":"object","properties":{"apiKey":{"description":"The API key","$ref":"#/components/schemas/ApiPolicyApiKeySaveModel"}}},"ApiPolicyApiKeySaveModel":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The API key identifier","format":"int64"}}},"ApiPolicyRequestLoggingSaveModel":{"required":["deployments","name","loggingFields"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The unique identifier of the request logging. Only provide a value when updating.","format":"int64"},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyDeploymentSaveModel"},"description":"The list of deployments associated with the request logging"},"name":{"type":"string","description":"The name of the request logging"},"loggingFields":{"description":"The fields logged by request logging","$ref":"#/components/schemas/JsonArray"},"ipLogging":{"description":"IpLoggingType of the request logging","$ref":"#/components/schemas/IpLoggingType"},"requestBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Request body maximum length for request logging","format":"int32"},"responseBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Response body maximum length for request logging","format":"int32"},"disableLogging":{"type":"boolean","description":"Disable logging for request logging"}}},"IpLoggingType":{"enum":["ClientIP","ClientIPXForwardedForFirst","ClientIPXForwardedForAll","Disable"]},"ParameterLocation":{"enum":["Query","Header","Path","Cookie"]},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## GET /api/v1/api-policies/{id}

> Get a single API policy

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"ApiPolicies"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/api-policies/{id}":{"get":{"tags":["ApiPolicies"],"summary":"Get a single API policy","operationId":"GetApiPolicy","parameters":[{"name":"id","in":"path","description":"API policy identifier","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseOfApiPolicyViewModel"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ResponseOfApiPolicyViewModel":{"required":["data"],"type":"object","properties":{"data":{"oneOf":[{"type":"null"},{"description":"Response data","$ref":"#/components/schemas/ApiPolicyViewModel"}]}}},"ApiPolicyViewModel":{"required":["name"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The identifier of the policy","format":"int64"},"uniqueIdentifier":{"type":"string","description":"The globally unique identifier of the policy","format":"uuid"},"modifier":{"type":["null","string"],"description":"The modifier of the policy"},"modifiedUtc":{"type":"string","description":"The timestamp when the policy was last modified","format":"date-time"},"targetEndpoints":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyTargetEndpointViewModel"},"description":"The list of target endpoints associated with the policy"},"identities":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyIdentityViewModel"},"description":"The list of identities associated with the policy"},"apiKeyGroups":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupViewModel"},"description":"The list of API key groups associated with the policy"},"publicAccessDeployments":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyDeploymentViewModel"},"description":"The list of deployments connected with public access identity"},"requestLoggingOptions":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyRequestLoggingViewModel"},"description":"The list of request logging options associated with the api policy"},"name":{"type":"string","description":"The name of the policy"},"description":{"type":["null","string"],"description":"The description of the policy"},"tags":{"type":["null","array"],"items":{"type":"string"},"description":"The tags of the policy"},"allowPublicAccess":{"type":"boolean","description":"Determines if public access is allowed"},"apiKeyName":{"type":"string","description":"The name of the API key"},"apiKeyLocation":{"description":"The location of the API key","$ref":"#/components/schemas/ParameterLocation"}}},"ApiPolicyTargetEndpointViewModel":{"required":["path"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the target endpoint","format":"int64"},"path":{"type":"string","description":"The path of the target endpoint"},"method":{"description":"The HTTP method of the target endpoint","$ref":"#/components/schemas/PolicyEndpointMethod"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"PolicyEndpointMethod":{"enum":["All","Get","Post","Put","Head","Delete","Patch","Options","Connect","Trace"]},"ApiPolicyIdentityViewModel":{"required":["issuers","name"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the identity","format":"int64"},"identityRules":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyIdentityRuleViewModel"}},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyDeploymentViewModel"},"description":"The list of deployments associated with the identity"},"isPrivateApplication":{"type":"boolean","description":"Determines if it is a private application"},"issuers":{"description":"The issuers of the identity","$ref":"#/components/schemas/JsonArray"},"name":{"type":"string","description":"The name of the identity"},"throttlingByClaim":{"type":["null","string"],"description":"The throttling by claim for the identity"},"priorityNumber":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"In case of 2 or more matching identities, determines which identity to use. Lower number will be selected.","format":"int32"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"ApiPolicyIdentityRuleViewModel":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the identity rule","format":"int64"},"ruleType":{"description":"The type of access rule","$ref":"#/components/schemas/ApiAccessRuleType"},"claim":{"type":["null","string"],"description":"The claim associated with the identity rule"},"value":{"type":["null","string"],"description":"The value associated with the identity rule"},"matchType":{"description":"The match type of the identity rule","$ref":"#/components/schemas/IdentityRuleMatchType"}}},"ApiAccessRuleType":{"enum":["Allow","Deny"]},"IdentityRuleMatchType":{"enum":["Exact","Exists","Regex"]},"ApiPolicyDeploymentViewModel":{"required":["agentGroupName"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the deployment","format":"int64"},"deployerUserName":{"type":"string","description":"The username of the deployer"},"deployedUtc":{"type":"string","description":"The timestamp when the deployment occurred","format":"date-time"},"agentGroupName":{"type":"string","description":"The Agent Group associated with the deployment"}}},"JsonArray":{"type":"array"},"ApiPolicyApiKeyGroupViewModel":{"required":["name"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the API key group","format":"int64"},"apiPolicyApiKeyGroupAssignments":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupAssignmentViewModel"},"description":"The API group assignments"},"name":{"type":"string","description":"The name of the API key group"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"ApiPolicyApiKeyGroupAssignmentViewModel":{"required":["apiKey"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The identifier of the assignment","format":"int64"},"apiKey":{"description":"The API key","$ref":"#/components/schemas/ApiKeyViewModel"}}},"ApiKeyViewModel":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"name":{"type":["null","string"]},"environment":{"type":["null","string"]},"value":{"type":"string","format":"uuid"}}},"ApiPolicyRequestLoggingViewModel":{"required":["name","loggingFields"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The unique identifier of the request logging","format":"int64"},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyDeploymentViewModel"},"description":"The list of deployments associated with the request logging"},"name":{"type":"string","description":"The name of the request logging"},"loggingFields":{"description":"The fields logged by request logging","$ref":"#/components/schemas/JsonArray"},"ipLogging":{"description":"IpLoggingType of the request logging","$ref":"#/components/schemas/IpLoggingType"},"requestBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Request body maximum length for request logging","format":"int32"},"responseBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Response body maximum length for request logging","format":"int32"},"disableLogging":{"type":"boolean","description":"Disable logging for request logging"}}},"IpLoggingType":{"enum":["ClientIP","ClientIPXForwardedForFirst","ClientIPXForwardedForAll","Disable"]},"ParameterLocation":{"enum":["Query","Header","Path","Cookie"]},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## PUT /api/v1/api-policies/{id}

> Update an API policy

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"ApiPolicies"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/api-policies/{id}":{"put":{"tags":["ApiPolicies"],"summary":"Update an API policy","parameters":[{"name":"id","in":"path","description":"API policy identifier","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPolicySaveModel"}}},"required":true},"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ApiPolicySaveModel":{"required":["targetEndpoints","name"],"type":"object","properties":{"targetEndpoints":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyTargetEndpointSaveModel"},"description":"The list of target endpoints associated with the policy"},"identities":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyIdentitySaveModel"},"description":"The list of identities associated with the policy"},"apiKeyGroups":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupSaveModel"},"description":"The list of API key groups associated with the policy"},"publicAccessDeployments":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyDeploymentSaveModel"},"description":"The list of deployments associated with the public access identity"},"requestLoggingOptions":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyRequestLoggingSaveModel"},"description":"The list of request logging options associated with the api policy"},"name":{"type":"string","description":"The name of the policy"},"description":{"type":["null","string"],"description":"The description of the policy"},"tags":{"type":["null","array"],"items":{"type":"string"},"description":"The tags of the policy"},"allowPublicAccess":{"type":"boolean","description":"Determines if public access is allowed"},"apiKeyName":{"type":"string","description":"The name of the API key"},"apiKeyLocation":{"description":"The location of the API key","$ref":"#/components/schemas/ParameterLocation"}}},"ApiPolicyTargetEndpointSaveModel":{"required":["path"],"type":"object","properties":{"path":{"type":"string","description":"The path of the target endpoint"},"method":{"description":"The HTTP method of the target endpoint","$ref":"#/components/schemas/PolicyEndpointMethod"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"PolicyEndpointMethod":{"enum":["All","Get","Post","Put","Head","Delete","Patch","Options","Connect","Trace"]},"ApiPolicyIdentitySaveModel":{"required":["deployments","issuers","name"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The unique identifier of the identity. Only provide a value when updating.","format":"int64"},"identityRules":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyIdentityRuleSaveModel"},"description":"The list of identity rules"},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyDeploymentSaveModel"},"description":"The list of deployments associated with the identity"},"isPrivateApplication":{"type":"boolean","description":"Determines if it is a private application"},"issuers":{"description":"The issuers of the identity","$ref":"#/components/schemas/JsonArray"},"name":{"type":"string","description":"The name of the identity"},"throttlingByClaim":{"type":["null","string"],"description":"The throttling by claim for the identity"},"priorityNumber":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"In case of 2 or more matching identities, determines which identity to use. Lower number will be selected.","format":"int32"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"ApiPolicyIdentityRuleSaveModel":{"required":["claim"],"type":"object","properties":{"ruleType":{"description":"The type of access rule","$ref":"#/components/schemas/ApiAccessRuleType"},"claim":{"type":"string","description":"The claim associated with the identity rule"},"value":{"type":["null","string"],"description":"The value associated with the identity rule"},"matchType":{"description":"The match type of the identity rule","$ref":"#/components/schemas/IdentityRuleMatchType"}}},"ApiAccessRuleType":{"enum":["Allow","Deny"]},"IdentityRuleMatchType":{"enum":["Exact","Exists","Regex"]},"ApiPolicyDeploymentSaveModel":{"required":["agentGroupName"],"type":"object","properties":{"agentGroupName":{"type":"string","description":"The Agent Group associated with the deployment"}}},"JsonArray":{"type":"array"},"ApiPolicyApiKeyGroupSaveModel":{"required":["apiPolicyApiKeyGroupAssignments","name"],"type":"object","properties":{"apiPolicyApiKeyGroupAssignments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupAssignmentSaveModel"},"description":"The API key group assignments"},"name":{"type":"string","description":"The name of the API key group"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The maximum amount of requests. Not null value requires RequestLimitWindowInMinutes to be set.","format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The request limit window in minutes. Not null value requires RequestLimit to be set.","format":"int32"}}},"ApiPolicyApiKeyGroupAssignmentSaveModel":{"required":["apiKey"],"type":"object","properties":{"apiKey":{"description":"The API key","$ref":"#/components/schemas/ApiPolicyApiKeySaveModel"}}},"ApiPolicyApiKeySaveModel":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"The API key identifier","format":"int64"}}},"ApiPolicyRequestLoggingSaveModel":{"required":["deployments","name","loggingFields"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"The unique identifier of the request logging. Only provide a value when updating.","format":"int64"},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyDeploymentSaveModel"},"description":"The list of deployments associated with the request logging"},"name":{"type":"string","description":"The name of the request logging"},"loggingFields":{"description":"The fields logged by request logging","$ref":"#/components/schemas/JsonArray"},"ipLogging":{"description":"IpLoggingType of the request logging","$ref":"#/components/schemas/IpLoggingType"},"requestBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Request body maximum length for request logging","format":"int32"},"responseBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Response body maximum length for request logging","format":"int32"},"disableLogging":{"type":"boolean","description":"Disable logging for request logging"}}},"IpLoggingType":{"enum":["ClientIP","ClientIPXForwardedForFirst","ClientIPXForwardedForAll","Disable"]},"ParameterLocation":{"enum":["Query","Header","Path","Cookie"]},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## DELETE /api/v1/api-policies/{id}

> Delete an API policy

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"ApiPolicies"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/api-policies/{id}":{"delete":{"tags":["ApiPolicies"],"summary":"Delete an API policy","parameters":[{"name":"id","in":"path","description":"API policy identifier","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int64"}}],"responses":{"204":{"description":"No Content"},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## GET /api/v1/api-policies/effective-api-policy

> Get effective API policy for a Frends endpoint

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"ApiPolicies"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/api-policies/effective-api-policy":{"get":{"tags":["ApiPolicies"],"summary":"Get effective API policy for a Frends endpoint","parameters":[{"name":"Path","in":"query","description":"Target endpoint path to search for","schema":{"type":"string"}},{"name":"Method","in":"query","description":"Target endpoint method","schema":{"$ref":"#/components/schemas/PolicyEndpointMethod"}},{"name":"AgentGroupName","in":"query","schema":{"type":"string"}},{"name":"ApiPolicyType","in":"query","schema":{"$ref":"#/components/schemas/ApiPolicyType"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseOfFindEffectiveApiPolicyViewModel"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"PolicyEndpointMethod":{"enum":["All","Get","Post","Put","Head","Delete","Patch","Options","Connect","Trace"]},"ApiPolicyType":{"enum":["Authentication","Logging",null]},"ResponseOfFindEffectiveApiPolicyViewModel":{"required":["data"],"type":"object","properties":{"data":{"oneOf":[{"type":"null"},{"description":"Response data","$ref":"#/components/schemas/FindEffectiveApiPolicyViewModel"}]}}},"FindEffectiveApiPolicyViewModel":{"required":["policy","endpoint"],"type":"object","properties":{"policy":{"$ref":"#/components/schemas/ApiPolicy"},"endpoint":{"$ref":"#/components/schemas/ApiPolicyTargetEndpoint"}}},"ApiPolicy":{"required":["uniqueIdentifier","name","modifier","apiKeyName","apiKeyLocation"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"uniqueIdentifier":{"type":"string","format":"uuid"},"name":{"type":"string"},"deletedUtc":{"type":["null","string"],"format":"date-time"},"description":{"type":["null","string"]},"modifier":{"type":"string"},"modifiedUtc":{"type":"string","format":"date-time"},"allowPublicAccess":{"type":"boolean"},"apiKeyName":{"type":"string"},"apiKeyLocation":{"$ref":"#/components/schemas/ParameterLocation"},"targetEndpoints":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyTargetEndpoint"}},"identities":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyIdentity"}},"apiKeyGroups":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroup"}},"requestLoggings":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyRequestLogging"}}}},"ParameterLocation":{"enum":["Query","Header","Path","Cookie"]},"ApiPolicyTargetEndpoint":{"required":["apiPolicy","path"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"apiPolicy":{"$ref":"#/components/schemas/ApiPolicy"},"path":{"type":"string"},"method":{"$ref":"#/components/schemas/PolicyEndpointMethod"},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"}}},"ApiPolicyIdentity":{"required":["apiPolicy"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"apiPolicy":{"$ref":"#/components/schemas/ApiPolicy"},"isPrivateApplication":{"type":"boolean"},"issuersJson":{"type":"string"},"name":{"type":"string"},"throttlingByClaim":{"type":["null","string"]},"priorityNumber":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"identityRules":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ApiPolicyIdentityRule"}},"deployments":{},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"}}},"ApiPolicyIdentityRule":{"required":["identity"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"identity":{"$ref":"#/components/schemas/ApiPolicyIdentity"},"ruleType":{"$ref":"#/components/schemas/ApiAccessRuleType"},"claim":{"type":"string"},"value":{"type":"string"},"matchType":{"$ref":"#/components/schemas/IdentityRuleMatchType"}}},"ApiAccessRuleType":{"enum":["Allow","Deny"]},"IdentityRuleMatchType":{"enum":["Exact","Exists","Regex"]},"ApiPolicyApiKeyGroup":{"required":["apiPolicy","name"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"apiPolicy":{"$ref":"#/components/schemas/ApiPolicy"},"name":{"type":"string"},"keyGroupAssignments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupAssignment"}},"requestLimit":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"requestLimitWindowInMinutes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"}}},"ApiPolicyApiKeyGroupAssignment":{"required":["apiKey","apiKeyGroup"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"apiKey":{"$ref":"#/components/schemas/ApiKey"},"apiKeyGroup":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroup"}}},"ApiKey":{"required":["name","environment","modifier"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"name":{"type":"string"},"value":{"type":"string","format":"uuid"},"environment":{"type":"string"},"modified":{"type":"string","format":"date-time"},"modifier":{"type":"string"},"groupAssignments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyApiKeyGroupAssignment"}}}},"ApiPolicyRequestLogging":{"required":["name","apiPolicy","loggingFieldsJson","ipLogging"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"name":{"type":"string"},"apiPolicy":{"$ref":"#/components/schemas/ApiPolicy"},"loggingFieldsJson":{"type":"string"},"ipLogging":{"$ref":"#/components/schemas/IpLoggingType"},"requestBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"responseBodyMaxLengthKb":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"disableLogging":{"type":"boolean"},"deployments":{"type":"array","items":{"$ref":"#/components/schemas/ApiPolicyRequestLoggingDeployment"}}}},"IpLoggingType":{"enum":["ClientIP","ClientIPXForwardedForFirst","ClientIPXForwardedForAll","Disable"]},"ApiPolicyRequestLoggingDeployment":{"required":["apiPolicyRequestLogging","agentGroupName","deployer"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"apiPolicyRequestLogging":{"$ref":"#/components/schemas/ApiPolicyRequestLogging"},"agentGroupName":{"type":"string"},"deployer":{"type":"string"},"deployedUtc":{"type":"string","format":"date-time"}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.frends.com/reference/frends-platform-api/platform-api-reference/api-policies.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
