---
title: "checkOrgPolicy"
---

> Documentation Index
> Fetch the complete documentation index at: https://buildrforge.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# checkOrgPolicy

Path: Forge API › policies

`POST /orgs/{org_id}/policy-checks`

Parse and check a policy file as saving it would, without saving: each problem with where it is and a suggested fix.

## Path parameters

- `org_id` (`checkOrgPolicy.path.org_id`; string, required)
  - pattern: `^org_[0-7][0-9a-hjkmnp-tv-z]{25}$`

## Request body

_Required._

- `source` (`checkOrgPolicy.source`; string, required)
  - minLength: `1`
- `repo_id` (`checkOrgPolicy.repo_id`; string, optional)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`

## Example request

```json
{
  "source": "string",
  "repo_id": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/orgs/<org_id>/policy-checks' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": "string",
  "repo_id": "string"
}
'
```

### TypeScript

```typescript
const url = '<base-url>/orgs/<org_id>/policy-checks';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({source: 'string', repo_id: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/orgs/<org_id>/policy-checks"

payload = {
    "source": "string",
    "repo_id": "string"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

PolicyCheck

#### Example

```json
{
  "problems": [
    {
      "severity": "error",
      "code": "syntax",
      "message": "string",
      "fix": "string",
      "location": {
        "line": -9007199254740991,
        "column": -9007199254740991
      },
      "policy": "string",
      "statement": -9007199254740991,
      "term": [
        0
      ]
    }
  ],
  "source": "string"
}
```

- `problems` (`checkOrgPolicy.response.200.problems`; array of object, required)
  - `severity` (`checkOrgPolicy.response.200.problems.severity`; string, required)
    - one of `"error"`, `"warning"`
  - `code` (`checkOrgPolicy.response.200.problems.code`; string, required)
    - one of `"syntax"`, `"unsupported"`, `"truthiness"`, `"duplicate"`, `"unknownModel"`, `"unknownField"`, `"unknownAction"`, `"unknownExtension"`, `"unknownTool"`, `"unknownWorkflow"`, `"unknownSchedule"`, `"unknownTrigger"`, `"unknownGroup"`, `"unknownRepo"`, `"notAReference"`, `"noRecord"`, `"crossRepo"`, `"repoAllow"`, `"orgActionInRepo"`, `"repoModelInOrgPolicy"`
  - `message` (`checkOrgPolicy.response.200.problems.message`; string, required)
  - `fix` (`checkOrgPolicy.response.200.problems.fix`; any of, required)
    - any of the following: `string`, `null`
  - `location` (`checkOrgPolicy.response.200.problems.location`; any of, required)
    - any of the following:
      - `object`
        - `line` (`checkOrgPolicy.response.200.problems.location.1.line`; integer, required)
          - maximum: `9007199254740991` · minimum: `-9007199254740991`
        - `column` (`checkOrgPolicy.response.200.problems.location.1.column`; integer, required)
          - maximum: `9007199254740991` · minimum: `-9007199254740991`
      - `null`
  - `policy` (`checkOrgPolicy.response.200.problems.policy`; any of, required)
    - any of the following: `string`, `null`
  - `statement` (`checkOrgPolicy.response.200.problems.statement`; any of, required)
    - any of the following: `integer`, `null`
  - `term` (`checkOrgPolicy.response.200.problems.term`; any of, required)
    - any of the following: `array<integer>`, `null`
- `source` (`checkOrgPolicy.response.200.source`; any of, required)
  - any of the following: `string`, `null`

### 400

InvalidRequest | RequestBodyTooDeep

#### Example

```json
{
  "_tag": "InvalidRequest",
  "part": "path",
  "issues": [
    {
      "path": [
        "string"
      ],
      "message": "string"
    }
  ]
}
```

Any of the following:

- `InvalidRequestEncoded`
  - `_tag` (`InvalidRequestEncoded._tag`; string, required)
    - one of `"InvalidRequest"`
  - `part` (`InvalidRequestEncoded.part`; string, required)
    - one of `"path"`, `"query"`, `"headers"`, `"body"`
  - `issues` (`InvalidRequestEncoded.issues`; array of object, required)
    - `path` (`InvalidRequestEncoded.issues.path`; array\<any of\>, required)
      - any of the following: `string`, `integer`
    - `message` (`InvalidRequestEncoded.issues.message`; string, required)
- `RequestBodyTooDeepEncoded`
  - `_tag` (`RequestBodyTooDeepEncoded._tag`; string, required)
    - one of `"RequestBodyTooDeep"`
  - `max_depth` (`RequestBodyTooDeepEncoded.max_depth`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 401

InvalidCredentials

#### Example

```json
{
  "_tag": "InvalidCredentials"
}
```

- `_tag` (`checkOrgPolicy.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 403

Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "Forbidden",
  "message": "string"
}
```

Any of the following:

- `ForbiddenEncoded`
  - `_tag` (`ForbiddenEncoded._tag`; string, required)
    - one of `"Forbidden"`
  - `message` (`ForbiddenEncoded.message`; string, required)
- `ForbiddenOriginEncoded`
  - `_tag` (`ForbiddenOriginEncoded._tag`; string, required)
    - one of `"ForbiddenOrigin"`
- `RequiresPersonalSessionEncoded`
  - `_tag` (`RequiresPersonalSessionEncoded._tag`; string, required)
    - one of `"RequiresPersonalSession"`
- `RunBranchRequiredEncoded`
  - `_tag` (`RunBranchRequiredEncoded._tag`; string, required)
    - one of `"RunBranchRequired"`
  - `branch` (`RunBranchRequiredEncoded.branch`; string, required)
    - minLength: `1`
  - `message` (`RunBranchRequiredEncoded.message`; string, required)

### 404

OrgNotFound | RepoNotFound

#### Example

```json
{
  "_tag": "OrgNotFound"
}
```

Any of the following:

- `OrgNotFoundEncoded`
  - `_tag` (`OrgNotFoundEncoded._tag`; string, required)
    - one of `"OrgNotFound"`
- `RepoNotFoundEncoded`
  - `_tag` (`RepoNotFoundEncoded._tag`; string, required)
    - one of `"RepoNotFound"`

### 413

RequestBodyTooLarge

#### Example

```json
{
  "_tag": "RequestBodyTooLarge",
  "max_bytes": -9007199254740991
}
```

- `_tag` (`checkOrgPolicy.response.413._tag`; string, required)
  - one of `"RequestBodyTooLarge"`
- `max_bytes` (`checkOrgPolicy.response.413.max_bytes`; integer, required)
  - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 429

RateLimited

#### Example

```json
{
  "_tag": "RateLimited"
}
```

- `_tag` (`checkOrgPolicy.response.429._tag`; string, required)
  - one of `"RateLimited"`

### 500

OrgFailure | RepoFailure

#### Example

```json
{
  "_tag": "OrgFailure",
  "reason": "string"
}
```

Every option has:

- `reason` (`<option>.reason`; string, required)

Any of the following, each adding:

- `OrgFailureEncoded`
  - `_tag` (`OrgFailureEncoded._tag`; string, required)
    - one of `"OrgFailure"`
- `RepoFailureEncoded`
  - `_tag` (`RepoFailureEncoded._tag`; string, required)
    - one of `"RepoFailure"`

### 503

SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "SessionUnavailable"
}
```

Any of the following:

- `SessionUnavailableEncoded`
  - `_tag` (`SessionUnavailableEncoded._tag`; string, required)
    - one of `"SessionUnavailable"`
- `RateLimitUnavailableEncoded`
  - `_tag` (`RateLimitUnavailableEncoded._tag`; string, required)
    - one of `"RateLimitUnavailable"`


Source: https://buildrforge.com/docs/api/check-org-policy/index.md
