# List security policies

Lists policies for the team or organization in creation order. Pagination count is the number of policies on this page. Authentication values are redacted.

Required permission: Account > Networking > SecurityPolicies > Read

**Query parameters:**

{object}
- `per_page`: (integer) The number of results to display per request. Maximum of 100 results per page.
- `page`: (integer) The page number to access.
- `cursor`: (string) The cursor returned from the previous page of results, used to request the next page. (min length: 24) (max length: 24)

**Response body:**

{object}
- `data`: {object}
  - `securityPolicies`: [array of] {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)
- `pagination`: {object}
  - `hasNextPage`: (boolean) (required) Is there another page of results available?
  - `cursor`: (string) The cursor to access the next page of results.
  - `count`: (number) (required) The number of results returned by this request. (format: float)

## API reference

GET /v1/security-policies

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

### Example Response

200 OK: A page of security policies.

```json
{
  "data": {
    "securityPolicies": [
      {
        "uid": "68f0aa1b9c4e2d7f11a3b402"
      }
    ]
  },
  "pagination": {
    "hasNextPage": false,
    "count": 1
  }
}
```

## CLI reference

$ northflank list security-policies

Options:

- `--per_page <per_page>`: The number of results to display per request. Maximum of 100 results per page.

- `--page <page>`: The page number to access.

- `--cursor <cursor>`: The cursor returned from the previous page of results, used to request the next page.

- `--verbose `: Verbose output

- `--quiet `: No console output

- `-o --output <format>`: Output formatting - custom-columns only applies for list commands

### Example Response

 A page of security policies.

```json
{
  "securityPolicies": [
    {
      "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.list.securityPolicies({
  options: {
    "per_page": 50,
    "page": 1
  }
});
```

### Example Response

 A page of security policies.

```json
{
  "data": {
    "securityPolicies": [
      {
        "uid": "68f0aa1b9c4e2d7f11a3b402"
      }
    ]
  },
  "pagination": {
    "hasNextPage": false,
    "count": 1
  },
  "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: [Trigger global secret dependents](/docs/v1/api/team/secrets/trigger-global-secret-dependents)

Next: [Create security policy](/docs/v1/api/team/security-policies/create-security-policy)