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

# Get Cli Rules

> Get organization and user rules for CLI applications.

This endpoint is designed for CLI applications that need to fetch both organization-specific
rules and user-specific custom prompts that are used in prompts. This includes:

- Organization rules: Same as MCP organization_rules prompt and agent prompt builders
- User custom prompt: Same as MCP user_custom_prompt and agent prompt builders

Returns the rules and prompts that should be followed by AI agents.

Rate limit: 30 requests per minute.



## OpenAPI

````yaml api-reference/openapi3.json get /v1/organizations/{org_id}/cli/rules
openapi: 3.1.0
info:
  title: Developer API
  description: API for application developers
  version: 1.0.0
servers:
  - url: https://api.codegen.com
    description: Codegen API
security: []
paths:
  /v1/organizations/{org_id}/cli/rules:
    get:
      tags:
        - cli-rules
        - cli-rules
        - cli-rules
      summary: Get Cli Rules
      description: >-
        Get organization and user rules for CLI applications.


        This endpoint is designed for CLI applications that need to fetch both
        organization-specific

        rules and user-specific custom prompts that are used in prompts. This
        includes:


        - Organization rules: Same as MCP organization_rules prompt and agent
        prompt builders

        - User custom prompt: Same as MCP user_custom_prompt and agent prompt
        builders


        Returns the rules and prompts that should be followed by AI agents.


        Rate limit: 30 requests per minute.
      operationId: get_cli_rules_v1_organizations__org_id__cli_rules_get
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: integer
            title: Org Id
        - name: authorization
          in: header
          required: false
          schema:
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CLIRulesResponse'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermissionsErrorResponse'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIRateLimitErrorResponse'
          description: Too Many Requests
components:
  schemas:
    CLIRulesResponse:
      properties:
        organization_rules:
          anyOf:
            - type: string
            - type: 'null'
          title: Organization Rules
        user_custom_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: User Custom Prompt
      type: object
      required:
        - organization_rules
        - user_custom_prompt
      title: CLIRulesResponse
      description: Response model for CLI rules containing organization and user rules.
    PermissionsErrorResponse:
      properties:
        message:
          type: string
          title: Message
          default: You do not have access to this organization.
        status_code:
          type: integer
          title: Status Code
          default: 403
      type: object
      title: PermissionsErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    APIRateLimitErrorResponse:
      properties:
        message:
          type: string
          title: Message
          default: Rate limit exceeded. Please try again later.
        status_code:
          type: integer
          title: Status Code
          default: 429
      type: object
      title: APIRateLimitErrorResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````