> ## Documentation Index
> Fetch the complete documentation index at: https://conductorone-docs-google-workspace-action-examples.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Denials

> Search budget-denial episodes for the organization within a time window.
 Requires the denial-read permission.



## OpenAPI

````yaml https://spec.speakeasy.com/conductor-one/conductorone/my-source-with-code-samples post /api/v1/spend-insights/denials/search
openapi: 3.1.0
info:
  description: The C1 API is a HTTP API for managing C1 resources.
  title: C1 API
  version: 0.1.0-alpha
servers:
  - description: The C1 API server for the current tenant.
    url: https://{tenantDomain}.conductor.one
    variables:
      tenantDomain:
        default: example
        description: The domain of the tenant to use for this request.
security:
  - bearerAuth: []
    oauth: []
paths:
  /api/v1/spend-insights/denials/search:
    post:
      tags:
        - Spend Insights
      summary: Search Denials
      description: |-
        Search budget-denial episodes for the organization within a time window.
         Requires the denial-read permission.
      operationId: c1.api.spendinsights.v1.SpendInsightsService.SearchDenials
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/c1.api.spendinsights.v1.SearchDenialsRequest
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/c1.api.spendinsights.v1.SearchDenialsResponse
          description: SearchDenialsResponse contains one page of denial episodes.
      x-codeSamples:
        - lang: go
          label: SearchDenials
          source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/shared\"\n\tconductoronesdkgo \"github.com/conductorone/conductorone-sdk-go\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := conductoronesdkgo.New(\n        conductoronesdkgo.WithSecurity(shared.Security{\n            BearerAuth: \"<YOUR_BEARER_TOKEN_HERE>\",\n            Oauth: \"<YOUR_OAUTH_HERE>\",\n        }),\n    )\n\n    res, err := s.SpendInsights.SearchDenials(ctx, nil)\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.SearchDenialsResponse != nil {\n        // handle response\n    }\n}"
components:
  schemas:
    c1.api.spendinsights.v1.SearchDenialsRequest:
      description: SearchDenialsRequest specifies denial filters and pagination.
      properties:
        filters:
          oneOf:
            - $ref: '#/components/schemas/c1.api.spendinsights.v1.DenialFilters'
            - type: 'null'
        pageSize:
          description: >-
            Maximum number of episodes to return. The default is 25 and the
            maximum is 100.
          format: int32
          type: integer
        pageToken:
          description: Pagination token from a previous response with the same filters.
          type: string
      title: Search Denials Request
      type: object
      x-speakeasy-name-override: SearchDenialsRequest
    c1.api.spendinsights.v1.SearchDenialsResponse:
      description: SearchDenialsResponse contains one page of denial episodes.
      properties:
        episodes:
          description: >-
            Episodes ordered by most recent refusal, then unique ID, both
            descending.
          items:
            $ref: '#/components/schemas/c1.api.spendinsights.v1.DenialEpisode'
          type:
            - array
            - 'null'
        nextPageToken:
          description: Token for the next page. Empty when no more episodes remain.
          type: string
      title: Search Denials Response
      type: object
      x-speakeasy-name-override: SearchDenialsResponse
    c1.api.spendinsights.v1.DenialFilters:
      description: DenialFilters selects budget-denial episodes.
      properties:
        authorityId:
          description: Optional authority ID to match. Set authority_kind with this field.
          type: string
        authorityKind:
          description: Optional authority type to match. Set authority_id with this field.
          enum:
            - AUTHORITY_KIND_UNSPECIFIED
            - AUTHORITY_KIND_FUND_POLICY
            - AUTHORITY_KIND_FUND_ASSIGNMENT
            - AUTHORITY_KIND_FUND_RULE
            - AUTHORITY_KIND_TENANT_APP_CAP
            - AUTHORITY_KIND_SUBJECT_APP_LIMIT
            - AUTHORITY_KIND_ENTITLEMENT_BINDING
            - AUTHORITY_KIND_APP_USER
            - AUTHORITY_KIND_USER
          type: string
          x-speakeasy-unknown-values: allow
        endTime:
          format: date-time
          type:
            - string
            - 'null'
        scopeAppId:
          description: Optional application scope ID to match.
          type: string
        scopeKind:
          description: Optional budget scope to match.
          enum:
            - SPEND_BLOCK_SCOPE_KIND_UNSPECIFIED
            - SPEND_BLOCK_SCOPE_KIND_TENANT
            - SPEND_BLOCK_SCOPE_KIND_SUBJECT
            - SPEND_BLOCK_SCOPE_KIND_APP
            - SPEND_BLOCK_SCOPE_KIND_SUBJECT_APP
          type: string
          x-speakeasy-unknown-values: allow
        scopeUserId:
          description: Optional user scope ID to match.
          type: string
        startTime:
          format: date-time
          type:
            - string
            - 'null'
        state:
          description: Optional current episode state to match.
          enum:
            - SPEND_BLOCK_STATE_UNSPECIFIED
            - SPEND_BLOCK_STATE_OPEN
            - SPEND_BLOCK_STATE_CLOSED
          type: string
          x-speakeasy-unknown-values: allow
      title: Denial Filters
      type: object
      x-speakeasy-name-override: DenialFilters
    c1.api.spendinsights.v1.DenialEpisode:
      description: >-
        DenialEpisode represents repeated budget refusals for one scope and
        budget period.
      properties:
        attemptCount:
          description: >-
            Best-effort lower bound for refused calls in this episode.
            Concurrent
             retry exhaustion can under-report; denial_events is exact for a window.
          format: int64
          type: string
        authorityId:
          description: Identifier of the configuration that supplied the denying limit.
          type: string
        authorityKind:
          description: Type of configuration that supplied the denying limit.
          enum:
            - AUTHORITY_KIND_UNSPECIFIED
            - AUTHORITY_KIND_FUND_POLICY
            - AUTHORITY_KIND_FUND_ASSIGNMENT
            - AUTHORITY_KIND_FUND_RULE
            - AUTHORITY_KIND_TENANT_APP_CAP
            - AUTHORITY_KIND_SUBJECT_APP_LIMIT
            - AUTHORITY_KIND_ENTITLEMENT_BINDING
            - AUTHORITY_KIND_APP_USER
            - AUTHORITY_KIND_USER
          type: string
          x-speakeasy-unknown-values: allow
        authorityVersion:
          description: Version of the configuration used for the first refusal.
          format: int64
          type: string
        blockId:
          description: Unique identifier for this denial episode.
          type: string
        budgetKey:
          description: Stable identifier for the budget account that denied the calls.
          type: string
        closedAt:
          format: date-time
          type:
            - string
            - 'null'
        firstDeniedAt:
          format: date-time
          type:
            - string
            - 'null'
        lastDeniedAt:
          format: date-time
          type:
            - string
            - 'null'
        periodEnd:
          format: date-time
          type:
            - string
            - 'null'
        periodKey:
          description: Stable key for the denied budget period.
          type: string
        periodKind:
          description: Length of the denied budget period.
          enum:
            - PERIOD_KIND_UNSPECIFIED
            - PERIOD_KIND_DAILY
            - PERIOD_KIND_WEEKLY
            - PERIOD_KIND_MONTHLY
            - PERIOD_KIND_QUARTERLY
            - PERIOD_KIND_YEARLY
          type: string
          x-speakeasy-unknown-values: allow
        periodStart:
          format: date-time
          type:
            - string
            - 'null'
        reason:
          description: Reason the calls were denied.
          enum:
            - DENY_REASON_UNSPECIFIED
            - DENY_REASON_TENANT_FROZEN
            - DENY_REASON_SUSPENDED_BY_ADMIN
            - DENY_REASON_APP_SUSPENDED
            - DENY_REASON_APP_PAUSED_BY_YOU
            - DENY_REASON_NO_SUPPLY
          type: string
          x-speakeasy-unknown-values: allow
        requestTaskId:
          description: ID of the access request task associated with this episode.
          type: string
        requestTaskState:
          description: Current state of the associated access request task.
          enum:
            - TICKET_STATE_UNSPECIFIED
            - TICKET_STATE_OPEN
            - TICKET_STATE_CLOSED
          type: string
          x-speakeasy-unknown-values: allow
        scopeAppId:
          description: Application ID for application-scoped episodes.
          type: string
        scopeKind:
          description: Budget scope that denied the calls.
          enum:
            - SPEND_BLOCK_SCOPE_KIND_UNSPECIFIED
            - SPEND_BLOCK_SCOPE_KIND_TENANT
            - SPEND_BLOCK_SCOPE_KIND_SUBJECT
            - SPEND_BLOCK_SCOPE_KIND_APP
            - SPEND_BLOCK_SCOPE_KIND_SUBJECT_APP
          type: string
          x-speakeasy-unknown-values: allow
        scopeUserId:
          description: User ID for user-scoped episodes.
          type: string
        state:
          description: Whether this denial episode remains open.
          enum:
            - SPEND_BLOCK_STATE_UNSPECIFIED
            - SPEND_BLOCK_STATE_OPEN
            - SPEND_BLOCK_STATE_CLOSED
          type: string
          x-speakeasy-unknown-values: allow
      title: Denial Episode
      type: object
      x-speakeasy-name-override: DenialEpisode
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    oauth:
      description: >-
        This API uses OAuth2 with the Client Credential flow.

        Client Credentials must be sent in the BODY, not the headers.

        For an example of how to implement this, refer to the
        [c1TokenSource.Token()](https://github.com/ConductorOne/conductorone-sdk-go/blob/3375fe7c0126d17e7ec4e711693dee7b791023aa/token_source.go#L101-L187)
        function.
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: /auth/v1/token
      type: oauth2

````