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

# CreateAccessRequest



## OpenAPI

````yaml /docs/api/openapi/approval_openapi.json post /core.v1.ApprovalService/CreateAccessRequest
openapi: 3.1.0
info:
  title: core.v1.ApprovalService
  version: 0.0.1
servers:
  - url: https://api.joinformal.com
    description: Production API
security: []
tags:
  - name: core.v1.ApprovalService
paths:
  /core.v1.ApprovalService/CreateAccessRequest:
    post:
      tags:
        - core.v1.ApprovalService
      summary: CreateAccessRequest
      operationId: core.v1.ApprovalService.CreateAccessRequest
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/core.v1.CreateAccessRequestRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.v1.CreateAccessRequestResponse'
        '400':
          description: Bad Request - Invalid request parameters or body
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: invalid_request
                  message:
                    type: string
                    example: Invalid request parameters
                  details:
                    type: object
        '401':
          description: Unauthorized - Missing or invalid authentication
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: unauthorized
                  message:
                    type: string
                    example: Authentication required
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: forbidden
                  message:
                    type: string
                    example: Insufficient permissions to perform this action
        '404':
          description: Not Found - Resource does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: not_found
                  message:
                    type: string
                    example: Resource not found
        '500':
          description: Internal Server Error - An error occurred processing the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: internal_error
                  message:
                    type: string
                    example: An internal error occurred
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -X POST
            "https://api.joinformal.com/core.v1.ApprovalService/CreateAccessRequest"
            \
              -H "X-API-KEY: YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "example": "value"
              }'
        - lang: javascript
          label: JavaScript (fetch)
          source: >-
            fetch("https://api.joinformal.com/core.v1.ApprovalService/CreateAccessRequest",
            {
              method: "POST",
              headers: {
                "X-API-KEY": "YOUR_API_KEY",
                "Content-Type": "application/json"
              },
              body: JSON.stringify({
                example: "value"
              })
            })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: python
          label: Python
          source: >-
            import requests


            url =
            "https://api.joinformal.com/core.v1.ApprovalService/CreateAccessRequest"

            headers = {
                "X-API-KEY": "YOUR_API_KEY",
                "Content-Type": "application/json"
            }

            data = {
                "example": "value"
            }


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

            print(response.json())
        - lang: go
          label: Go
          source: |-
            package main

            import (
                "bytes"
                "encoding/json"
                "fmt"
                "io"
                "net/http"
            )

            func main() {
                url := "https://api.joinformal.com/core.v1.ApprovalService/CreateAccessRequest"

                body := map[string]string{
                    "example": "value",
                }

                jsonData, _ := json.Marshal(body)

                req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
                req.Header.Set("X-API-KEY", "YOUR_API_KEY")
                req.Header.Set("Content-Type", "application/json")

                client := &http.Client{}
                resp, err := client.Do(req)
                if err != nil {
                    panic(err)
                }
                defer resp.Body.Close()

                responseBody, _ := io.ReadAll(resp.Body)
                fmt.Println(string(responseBody))
            }
components:
  schemas:
    core.v1.CreateAccessRequestRequest:
      type: object
      properties:
        reason:
          type: string
          title: reason
          maxLength: 4000
        policyId:
          type: string
          title: policy_id
        payload:
          $ref: '#/components/schemas/core.v1.UserAccessRequestPayload'
          title: payload
        requesterUserId:
          type: string
          title: requester_user_id
          minLength: 1
      title: CreateAccessRequestRequest
      required:
        - payload
      additionalProperties: false
    core.v1.CreateAccessRequestResponse:
      type: object
      title: CreateAccessRequestResponse
      additionalProperties: false
    core.v1.UserAccessRequestPayload:
      type: object
      properties:
        customPolicyAccess:
          $ref: '#/components/schemas/core.v1.UserCustomPolicyAccess'
          title: custom_policy_access
          description: One of the discriminated union fields - use exactly one
        mcpRegistryAccess:
          $ref: '#/components/schemas/core.v1.UserMcpRegistryAccess'
          title: mcp_registry_access
          description: One of the discriminated union fields - use exactly one
        mcpServerCreate:
          $ref: '#/components/schemas/core.v1.UserMcpServerCreate'
          title: mcp_server_create
          description: One of the discriminated union fields - use exactly one
        policySuspension:
          $ref: '#/components/schemas/core.v1.UserPolicySuspension'
          title: policy_suspension
          description: One of the discriminated union fields - use exactly one
      title: UserAccessRequestPayload
      additionalProperties: false
      description: >-
        Exactly one of these fields is required: custom_policy_access or
        mcp_registry_access or mcp_server_create or policy_suspension.
    core.v1.UserCustomPolicyAccess:
      type: object
      properties:
        scope:
          $ref: '#/components/schemas/core.v1.UserExactActionScope'
          title: scope
      title: UserCustomPolicyAccess
      required:
        - scope
      additionalProperties: false
    core.v1.UserMcpRegistryAccess:
      type: object
      properties:
        resourceId:
          type: string
          title: resource_id
          minLength: 1
      title: UserMcpRegistryAccess
      additionalProperties: false
    core.v1.UserMcpServerCreate:
      type: object
      properties:
        name:
          type: string
          title: name
          minLength: 1
        url:
          type: string
          title: url
          minLength: 1
      title: UserMcpServerCreate
      additionalProperties: false
    core.v1.UserPolicySuspension:
      type: object
      properties:
        scope:
          $ref: '#/components/schemas/core.v1.UserApprovalAccessScope'
          title: scope
        oneTime:
          $ref: '#/components/schemas/core.v1.UserOneTimeAccess'
          title: one_time
          description: One of the discriminated union fields - use exactly one
        timeBound:
          $ref: '#/components/schemas/core.v1.UserTimeBoundAccess'
          title: time_bound
          description: One of the discriminated union fields - use exactly one
      title: UserPolicySuspension
      additionalProperties: false
      description: 'Exactly one of these fields is required: one_time or time_bound.'
    core.v1.UserExactActionScope:
      type: object
      properties:
        mcpMethod:
          type: string
          title: mcp_method
          minLength: 1
        toolName:
          type: string
          title: tool_name
        toolArguments:
          $ref: '#/components/schemas/google.protobuf.Struct'
          title: tool_arguments
      title: UserExactActionScope
      additionalProperties: false
    core.v1.UserApprovalAccessScope:
      type: object
      properties:
        exactAction:
          $ref: '#/components/schemas/core.v1.UserExactActionScope'
          title: exact_action
          description: One of the discriminated union fields - use exactly one
        full:
          $ref: '#/components/schemas/core.v1.UserFullPolicyScope'
          title: full
          description: One of the discriminated union fields - use exactly one
      title: UserApprovalAccessScope
      additionalProperties: false
      description: 'Exactly one of these fields is required: exact_action or full.'
    core.v1.UserOneTimeAccess:
      type: object
      title: UserOneTimeAccess
      additionalProperties: false
    core.v1.UserTimeBoundAccess:
      type: object
      properties:
        expirationMinutes:
          exclusiveMinimum: 0
          type:
            - integer
            - string
          title: expiration_minutes
          format: int64
      title: UserTimeBoundAccess
      additionalProperties: false
    google.protobuf.Struct:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/google.protobuf.Value'
      description: |-
        `Struct` represents a structured data value, consisting of fields
         which map to dynamically typed values. In some languages, `Struct`
         might be supported by a native representation. For example, in
         scripting languages like JS a struct is represented as an
         object. The details of that representation are described together
         with the proto support for the language.

         The JSON representation for `Struct` is JSON object.
    core.v1.UserFullPolicyScope:
      type: object
      title: UserFullPolicyScope
      additionalProperties: false
    google.protobuf.Value:
      oneOf:
        - type: 'null'
        - type: number
        - type: string
        - type: boolean
        - type: array
        - type: object
          additionalProperties: true
      description: |-
        `Value` represents a dynamically typed value which can be either
         null, a number, a string, a boolean, a recursive struct value, or a
         list of values. A producer of value is expected to set one of these
         variants. Absence of any variant indicates an error.

         The JSON representation for `Value` is JSON value.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key authentication. Get your API key from the Control Plane.

````