> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/api-reference/identity-and-access-management-iam/directory-security-policies.md).

# Directory Security Policies

Operations related to Directory Security Policies that define authentication and authorization rules.

## GET /communities/{community\_id}/security\_policies/{policy\_id}

> Find a security policy

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Directory Security Policies","description":"Operations related to Directory Security Policies that define authentication and authorization rules."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/communities/{community_id}/security_policies/{policy_id}":{"get":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/SecurityPolicyResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"description":"","tags":["Directory Security Policies"],"parameters":[{"required":true,"name":"community_id","style":"simple","explode":false,"schema":{"type":"integer","format":"int64"},"in":"path"},{"explode":false,"name":"policy_id","style":"simple","required":true,"schema":{"type":"integer","format":"int64"},"in":"path"}],"summary":"Find a security policy","operationId":"findSecurityPolicy"}}},"components":{"schemas":{"SecurityPolicyResource":{"discriminator":{"propertyName":"type","mapping":{"PASSWORD_RENEWAL":"#/components/schemas/PasswordRenewalResource","TWO_FACTOR_AUTHENTICATION":"#/components/schemas/TwoFactorAuthenticationResource","PASSWORD_REQUIREMENTS":"#/components/schemas/PasswordRequirementResource"}},"oneOf":[{"$ref":"#/components/schemas/PasswordRenewalResource"},{"$ref":"#/components/schemas/TwoFactorAuthenticationResource"},{"$ref":"#/components/schemas/PasswordRequirementResource"}],"properties":{"type":{"type":"string","enum":["PASSWORD_RENEWAL","TWO_FACTOR_AUTHENTICATION","PASSWORD_REQUIREMENTS"]}},"required":["type"]},"PasswordRenewalResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"policy_renewal_period":{"type":"string","description":"A valid ISO 8601 Period String","readOnly":false}},"required":["archived","community_id","id","policy_renewal_period"]},"TwoFactorAuthenticationResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"two_factor_type":{"$ref":"#/components/schemas/TwoFactorAuthenticationType"}},"required":["archived","community_id","id","two_factor_type"]},"TwoFactorAuthenticationType":{"type":"string","enum":["TEXT","VOICE","AUTHENTICATOR"],"readOnly":false},"PasswordRequirementResource":{"type":"object","properties":{"min_special_chars_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"different_letter_case_needed":{"type":"boolean","default":false,"readOnly":false},"min_digit_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"community_id":{"type":"string","readOnly":true},"forbid_popular_passwords":{"type":"boolean","default":false,"readOnly":false},"min_length":{"type":"integer","format":"int64","default":0,"readOnly":false}},"required":["archived","community_id","different_letter_case_needed","forbid_popular_passwords","id","min_digit_count","min_length","min_special_chars_count"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /communities/{community\_id}/security\_policies/{policy\_id}

> Update a security policy

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Directory Security Policies","description":"Operations related to Directory Security Policies that define authentication and authorization rules."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/communities/{community_id}/security_policies/{policy_id}":{"put":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/SecurityPolicyResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"requestBody":{"description":"The security policy to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityPolicyResource"}}},"required":true},"description":"","tags":["Directory Security Policies"],"summary":"Update a security policy","parameters":[{"explode":false,"required":true,"name":"community_id","in":"path","schema":{"type":"integer","format":"int64"},"style":"simple"},{"name":"policy_id","style":"simple","schema":{"type":"integer","format":"int64"},"explode":false,"in":"path","required":true}],"operationId":"updateSecurityPolicy"}}},"components":{"schemas":{"SecurityPolicyResource":{"discriminator":{"propertyName":"type","mapping":{"PASSWORD_RENEWAL":"#/components/schemas/PasswordRenewalResource","TWO_FACTOR_AUTHENTICATION":"#/components/schemas/TwoFactorAuthenticationResource","PASSWORD_REQUIREMENTS":"#/components/schemas/PasswordRequirementResource"}},"oneOf":[{"$ref":"#/components/schemas/PasswordRenewalResource"},{"$ref":"#/components/schemas/TwoFactorAuthenticationResource"},{"$ref":"#/components/schemas/PasswordRequirementResource"}],"properties":{"type":{"type":"string","enum":["PASSWORD_RENEWAL","TWO_FACTOR_AUTHENTICATION","PASSWORD_REQUIREMENTS"]}},"required":["type"]},"PasswordRenewalResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"policy_renewal_period":{"type":"string","description":"A valid ISO 8601 Period String","readOnly":false}},"required":["archived","community_id","id","policy_renewal_period"]},"TwoFactorAuthenticationResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"two_factor_type":{"$ref":"#/components/schemas/TwoFactorAuthenticationType"}},"required":["archived","community_id","id","two_factor_type"]},"TwoFactorAuthenticationType":{"type":"string","enum":["TEXT","VOICE","AUTHENTICATOR"],"readOnly":false},"PasswordRequirementResource":{"type":"object","properties":{"min_special_chars_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"different_letter_case_needed":{"type":"boolean","default":false,"readOnly":false},"min_digit_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"community_id":{"type":"string","readOnly":true},"forbid_popular_passwords":{"type":"boolean","default":false,"readOnly":false},"min_length":{"type":"integer","format":"int64","default":0,"readOnly":false}},"required":["archived","community_id","different_letter_case_needed","forbid_popular_passwords","id","min_digit_count","min_length","min_special_chars_count"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /communities/{community\_id}/security\_policies/{policy\_id}

> Delete a security policy

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Directory Security Policies","description":"Operations related to Directory Security Policies that define authentication and authorization rules."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/communities/{community_id}/security_policies/{policy_id}":{"delete":{"description":"","parameters":[{"in":"path","required":true,"explode":false,"name":"community_id","schema":{"type":"integer","format":"int64"},"style":"simple"},{"schema":{"type":"integer","format":"int64"},"name":"policy_id","explode":false,"in":"path","style":"simple","required":true}],"operationId":"deleteSecurityPolicy","responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Delete a security policy","tags":["Directory Security Policies"]}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}}}}
```

## GET /communities/{community\_id}/security\_policies

> Search security policies

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Directory Security Policies","description":"Operations related to Directory Security Policies that define authentication and authorization rules."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/communities/{community_id}/security_policies":{"get":{"summary":"Search security policies","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SecurityPolicyResource"}},"total":{"type":"integer"},"max_results":{"type":"integer"},"first_result":{"type":"integer"},"status":{"type":"string","enum":["ok"]},"count":{"type":"integer"}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"explode":false,"required":true,"in":"path","style":"simple","schema":{"type":"integer","format":"int64"},"name":"community_id"},{"name":"type","style":"form","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SecurityPolicyType"},"explode":true},{"style":"form","schema":{"type":"boolean"},"explode":true,"name":"archived","in":"query","required":false},{"name":"first_result","required":false,"style":"form","in":"query","schema":{"type":"integer","format":"int32"},"explode":true},{"name":"max_results","in":"query","explode":true,"schema":{"type":"integer","format":"int32"},"required":false,"style":"form"}],"description":"","operationId":"findSecurityPolicies","tags":["Directory Security Policies"]}}},"components":{"schemas":{"SecurityPolicyResource":{"discriminator":{"propertyName":"type","mapping":{"PASSWORD_RENEWAL":"#/components/schemas/PasswordRenewalResource","TWO_FACTOR_AUTHENTICATION":"#/components/schemas/TwoFactorAuthenticationResource","PASSWORD_REQUIREMENTS":"#/components/schemas/PasswordRequirementResource"}},"oneOf":[{"$ref":"#/components/schemas/PasswordRenewalResource"},{"$ref":"#/components/schemas/TwoFactorAuthenticationResource"},{"$ref":"#/components/schemas/PasswordRequirementResource"}],"properties":{"type":{"type":"string","enum":["PASSWORD_RENEWAL","TWO_FACTOR_AUTHENTICATION","PASSWORD_REQUIREMENTS"]}},"required":["type"]},"PasswordRenewalResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"policy_renewal_period":{"type":"string","description":"A valid ISO 8601 Period String","readOnly":false}},"required":["archived","community_id","id","policy_renewal_period"]},"TwoFactorAuthenticationResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"two_factor_type":{"$ref":"#/components/schemas/TwoFactorAuthenticationType"}},"required":["archived","community_id","id","two_factor_type"]},"TwoFactorAuthenticationType":{"type":"string","enum":["TEXT","VOICE","AUTHENTICATOR"],"readOnly":false},"PasswordRequirementResource":{"type":"object","properties":{"min_special_chars_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"different_letter_case_needed":{"type":"boolean","default":false,"readOnly":false},"min_digit_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"community_id":{"type":"string","readOnly":true},"forbid_popular_passwords":{"type":"boolean","default":false,"readOnly":false},"min_length":{"type":"integer","format":"int64","default":0,"readOnly":false}},"required":["archived","community_id","different_letter_case_needed","forbid_popular_passwords","id","min_digit_count","min_length","min_special_chars_count"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]},"SecurityPolicyType":{"type":"string","enum":["PASSWORD_RENEWAL","TWO_FACTOR_AUTHENTICATION","PASSWORD_REQUIREMENT"],"readOnly":false}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /communities/{community\_id}/security\_policies

> Create a new security policy

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Directory Security Policies","description":"Operations related to Directory Security Policies that define authentication and authorization rules."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/communities/{community_id}/security_policies":{"post":{"parameters":[{"in":"path","name":"community_id","explode":false,"required":true,"schema":{"type":"integer","format":"int64"},"style":"simple"}],"description":"","requestBody":{"description":"The security policy to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityPolicyResource"}}},"required":true},"operationId":"createSecurityPolicy","summary":"Create a new security policy","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/SecurityPolicyResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"tags":["Directory Security Policies"]}}},"components":{"schemas":{"SecurityPolicyResource":{"discriminator":{"propertyName":"type","mapping":{"PASSWORD_RENEWAL":"#/components/schemas/PasswordRenewalResource","TWO_FACTOR_AUTHENTICATION":"#/components/schemas/TwoFactorAuthenticationResource","PASSWORD_REQUIREMENTS":"#/components/schemas/PasswordRequirementResource"}},"oneOf":[{"$ref":"#/components/schemas/PasswordRenewalResource"},{"$ref":"#/components/schemas/TwoFactorAuthenticationResource"},{"$ref":"#/components/schemas/PasswordRequirementResource"}],"properties":{"type":{"type":"string","enum":["PASSWORD_RENEWAL","TWO_FACTOR_AUTHENTICATION","PASSWORD_REQUIREMENTS"]}},"required":["type"]},"PasswordRenewalResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"policy_renewal_period":{"type":"string","description":"A valid ISO 8601 Period String","readOnly":false}},"required":["archived","community_id","id","policy_renewal_period"]},"TwoFactorAuthenticationResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"community_id":{"type":"string","readOnly":true},"archived":{"type":"boolean","default":false,"readOnly":false},"two_factor_type":{"$ref":"#/components/schemas/TwoFactorAuthenticationType"}},"required":["archived","community_id","id","two_factor_type"]},"TwoFactorAuthenticationType":{"type":"string","enum":["TEXT","VOICE","AUTHENTICATOR"],"readOnly":false},"PasswordRequirementResource":{"type":"object","properties":{"min_special_chars_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"different_letter_case_needed":{"type":"boolean","default":false,"readOnly":false},"min_digit_count":{"type":"integer","format":"int64","default":0,"readOnly":false},"community_id":{"type":"string","readOnly":true},"forbid_popular_passwords":{"type":"boolean","default":false,"readOnly":false},"min_length":{"type":"integer","format":"int64","default":0,"readOnly":false}},"required":["archived","community_id","different_letter_case_needed","forbid_popular_passwords","id","min_digit_count","min_length","min_special_chars_count"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```


---

# 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.mediarithmics.io/api-reference/identity-and-access-management-iam/directory-security-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.
