# Get security policy

Gets policy details with passwords and authentication header values redacted.

Required permission: Account > Networking > SecurityPolicies > Read

**Path parameters:**

{object}
- `securityPolicyId`: (string) (required) ID of the security policy

**Response body:**

{object}
- `data`: {object}
  - `id`: (string) (required) (pattern: ^[A-Za-z0-9-]+$)
  - `uid`: (string) (required) Permanent identifier for the resource. Unlike `id`, it never changes and is never reused. (min length: 24) (max length: 24)
  - `name`: (string) (required) (pattern: ^[a-zA-Z]((-|\s)?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$) (min length: 3) (max length: 39)
  - `description`: (string) (pattern: ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$) (max length: 200)
  - `entityType`: (string) (required) (enum: team, org)
  - `spec`: (multiple options) {object}
     - `enabled`: (boolean) (required)
     - `priority`: (integer) (required)
     - `paths`: [array of] {object}
         - `path`: (string) (required) (min length: 1)
         - `matchMode`: (string) (required) (enum: exact, pathPrefix)
     - `accessMode`: (string) (required) (enum: protected, unprotected)
     - `securityPolicies`: {object}
       - `orPolicies`: {object}
         - `ip`: [array of] {object}
             - `addresses`: [array of] (string)
             - `action`: (string) (required) (enum: ALLOW, DENY)
         - `headers`: [array of] {object}
             - `name`: (string) (required)
             - `regexMode`: (boolean)
             - `valueConfigured`: (boolean) (required)
         - `credentials`: [array of] {object}
             - `username`: (string) (required)
             - `type`: (string) (required) (enum: basic-auth)
             - `passwordConfigured`: (boolean) (required)
         - `sso`: {object}
           - `organizationId`: (string) (required)
           - `directoryGroupIds`: [array of] (string)
           - `allowAnyOrgUsers`: (boolean)
           - `validateInternalTraffic`: (boolean)
           - `setCookieOnRootDomain`: (boolean)
           - `noindexRedirect`: (boolean)
           - `allowInternalTrafficViaPublicDns`: (boolean)
       - `requiredPolicies`: {object}
         - `ip`: [array of] {object}
             - `addresses`: [array of] (string)
             - `action`: (string) (required) (enum: ALLOW, DENY)
         - `headers`: [array of] {object}
             - `name`: (string) (required)
             - `regexMode`: (boolean)
             - `valueConfigured`: (boolean) (required)
         - `credentials`: [array of] {object}
             - `username`: (string) (required)
             - `type`: (string) (required) (enum: basic-auth)
             - `passwordConfigured`: (boolean) (required)
         - `sso`: {object}
           - `organizationId`: (string) (required)
           - `directoryGroupIds`: [array of] (string)
           - `allowAnyOrgUsers`: (boolean)
           - `validateInternalTraffic`: (boolean)
           - `setCookieOnRootDomain`: (boolean)
           - `noindexRedirect`: (boolean)
           - `allowInternalTrafficViaPublicDns`: (boolean)
     - `targets`: {object}
       - `projects`: {object}
         - `mode`: (string) (required) (enum: all, selected)
         - `ids`: [array of] (string)
       - `workloads`: {object}
         - `mode`: (string) (required) (enum: all, selected)
         - `items`: [array of] {object}
             - `projectId`: (string) (required)
             - `serviceId`: (string) (required)
       - `tags`: {object}
         - `enabled`: (boolean) (required)
         - `items`: [array of] (string)
         - `matchCondition`: (string) (required) (enum: or, and)
     - `exclusions`: {object}
       - `projects`: [array of] (string)
       - `workloads`: [array of] {object}
           - `projectId`: (string) (required)
           - `serviceId`: (string) (required)
           - `reason`: (string) (max length: 500) | {object}
     - `enabled`: (boolean) (required)
     - `priority`: (integer) (required)
     - `paths`: [array of] {object}
         - `path`: (string) (required) (min length: 1)
         - `matchMode`: (string) (required) (enum: exact, pathPrefix)
     - `accessMode`: (string) (required) (enum: protected, unprotected)
     - `securityPolicies`: {object}
       - `orPolicies`: {object}
         - `ip`: [array of] {object}
             - `addresses`: [array of] (string)
             - `action`: (string) (required) (enum: ALLOW, DENY)
         - `headers`: [array of] {object}
             - `name`: (string) (required)
             - `regexMode`: (boolean)
             - `valueConfigured`: (boolean) (required)
         - `credentials`: [array of] {object}
             - `username`: (string) (required)
             - `type`: (string) (required) (enum: basic-auth)
             - `passwordConfigured`: (boolean) (required)
         - `sso`: {object}
           - `organizationId`: (string) (required)
           - `directoryGroupIds`: [array of] (string)
           - `allowAnyOrgUsers`: (boolean)
           - `validateInternalTraffic`: (boolean)
           - `setCookieOnRootDomain`: (boolean)
           - `noindexRedirect`: (boolean)
           - `allowInternalTrafficViaPublicDns`: (boolean)
       - `requiredPolicies`: {object}
         - `ip`: [array of] {object}
             - `addresses`: [array of] (string)
             - `action`: (string) (required) (enum: ALLOW, DENY)
         - `headers`: [array of] {object}
             - `name`: (string) (required)
             - `regexMode`: (boolean)
             - `valueConfigured`: (boolean) (required)
         - `credentials`: [array of] {object}
             - `username`: (string) (required)
             - `type`: (string) (required) (enum: basic-auth)
             - `passwordConfigured`: (boolean) (required)
         - `sso`: {object}
           - `organizationId`: (string) (required)
           - `directoryGroupIds`: [array of] (string)
           - `allowAnyOrgUsers`: (boolean)
           - `validateInternalTraffic`: (boolean)
           - `setCookieOnRootDomain`: (boolean)
           - `noindexRedirect`: (boolean)
           - `allowInternalTrafficViaPublicDns`: (boolean)
     - `targets`: {object}
       - `teams`: {object}
         - `mode`: (string) (required) (enum: allManaged, selected)
         - `ids`: [array of] (string)
       - `projects`: {object}
         - `mode`: (string) (required) (enum: all, selected)
         - `items`: [array of] {object}
             - `teamId`: (string) (required)
             - `projectId`: (string) (required)
       - `tags`: {object}
         - `enabled`: (boolean) (required)
         - `items`: [array of] (string)
         - `matchCondition`: (string) (required) (enum: or, and)
     - `exclusions`: {object}
       - `teams`: [array of] (string)
       - `projects`: [array of] {object}
           - `teamId`: (string) (required)
           - `projectId`: (string) (required)
     - `inheritanceMode`: (string) (required) (enum: enforced, default)
  - `lifecycleStatus`: (string) (required) (enum: created, pending, error, deleting, deletion_error)
  - `createdAt`: (string) (required) (format: date-time)
  - `updatedAt`: (string) (required) (format: date-time)
  - `state`: {object}
    - `lastSyncAttemptAt`: (string) (format: date-time)
    - `lastSyncedAt`: (string) (format: date-time)
    - `counts`: {object}
      - `matched`: (integer) (required)
      - `excluded`: (integer) (required)
      - `unsupported`: (integer) (required)
      - `pending`: (integer) (required)
      - `inSync`: (integer) (required)
      - `error`: (integer) (required)
    - `warnings`: [array of] {object}
        - `code`: (string) (required) (enum: defaultOverrodeEnforced)
        - `winningDefaultPolicyId`: (string) (required)
        - `shadowedEnforcedPolicyIds`: [array of] (string)
        - `affectedCount`: (integer) (required)
        - `risk`: (string) (required) (enum: nestedDelegation, broadeningDelegation)

## API reference

GET /v1/security-policies/{securityPolicyId}

GET /v1/teams/{teamId}/security-policies/{securityPolicyId}

### Example Response

200 OK: Details about the security policy.

```json
{
  "data": {
    "uid": "68f0aa1b9c4e2d7f11a3b402"
  }
}
```

## CLI reference

$ northflank get security-policy

Options:

- `--securityPolicyId <securityPolicyId>`: ID of the security policy

- `--verbose `: Verbose output

- `--quiet `: No console output

- `-o --output <format>`: Output formatting 

### Example Response

 Details about the security policy.

```json
{
  "uid": "68f0aa1b9c4e2d7f11a3b402"
}
```

## JavaScript client reference

### Example request



With an organization token, add `parameters.teamId`. [Organization API access](/docs/v1/api/use-the-api#organization-api-access).

```javascript
await apiClient.get.securityPolicy({
  parameters: {
    "securityPolicyId": "internal-access"
  }
});
```

### Example Response

 Details about the security policy.

```json
{
  "data": {
    "uid": "68f0aa1b9c4e2d7f11a3b402"
  },
  "rawResponse": "...",
  "request": "...",
  "error": "..."
}
```

## Python client reference

### Example request

[Set up the Python client](/docs/v1/api/use-the-python-client#usage).



With an organization token, add `team_id`. [Organization API access](/docs/v1/api/use-the-api#organization-api-access).

Python SDK 2.1.0 has no generated method for this endpoint. Use the API example for this request.

Previous: [Put security policy](/docs/v1/api/org/security-policies/put-security-policy)

Next: [Patch security policy](/docs/v1/api/org/security-policies/patch-security-policy)