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

# Set Limit

> Cap what one app may take from this subject's fund, creating the row if
 absent. Amount arm only; leaves any pause in place.



## OpenAPI

````yaml https://spec.speakeasy.com/conductor-one/conductorone/my-source-with-code-samples post /api/v1/funds/subject-app-limits/{user_id}/{app_id}/limit
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/funds/subject-app-limits/{user_id}/{app_id}/limit:
    post:
      tags:
        - Subject App Limits
      summary: Set Limit
      description: |-
        Cap what one app may take from this subject's fund, creating the row if
         absent. Amount arm only; leaves any pause in place.
      operationId: c1.api.funds.v1.SubjectAppLimitService.SetLimit
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            description: The userId field.
            type: string
        - in: path
          name: app_id
          required: true
          schema:
            description: The appId field.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/c1.api.funds.v1.SubjectAppLimitServiceSetLimitRequestInput
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/c1.api.funds.v1.SubjectAppLimitServiceSetLimitResponse
          description: Successful response
      x-codeSamples:
        - lang: go
          label: SetLimit
          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\"github.com/conductorone/conductorone-sdk-go/pkg/models/operations\"\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.SubjectAppLimit.SetLimit(ctx, operations.C1APIFundsV1SubjectAppLimitServiceSetLimitRequest{\n        AppID: \"<id>\",\n        UserID: \"<id>\",\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.SubjectAppLimitServiceSetLimitResponse != nil {\n        // handle response\n    }\n}"
        - lang: typescript
          label: Typescript (SDK)
          source: >-
            import { ConductoroneSDKTypescript } from
            "conductorone-sdk-typescript";


            const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
              security: {
                bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
                oauth: "<YOUR_OAUTH_HERE>",
              },
            });


            async function run() {
              const result = await conductoroneSDKTypescript.subjectAppLimit.setLimit({
                userId: "<id>",
                appId: "<id>",
              });

              console.log(result);
            }


            run();
components:
  schemas:
    c1.api.funds.v1.SubjectAppLimitServiceSetLimitRequestInput:
      description: The SubjectAppLimitServiceSetLimitRequest message.
      properties:
        limit:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendLimit'
            - type: 'null'
        period:
          description: >-
            Optional period override. Only valid together with the limit it
            denominates.
          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
      title: Subject App Limit Service Set Limit Request
      type: object
      x-speakeasy-name-override: SubjectAppLimitServiceSetLimitRequest
    c1.api.funds.v1.SubjectAppLimitServiceSetLimitResponse:
      description: The SubjectAppLimitServiceSetLimitResponse message.
      properties:
        limit:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SubjectAppLimit'
            - type: 'null'
      title: Subject App Limit Service Set Limit Response
      type: object
      x-speakeasy-name-override: SubjectAppLimitServiceSetLimitResponse
    c1.api.funds.v1.SpendLimit:
      description: >
        SpendLimit distinguishes an amount, unlimited tracking and blocked
        supply.


        This message contains a oneof named kind. Only a single field of the
        following list may be set at a time:
          - unlimited
          - amount
          - blocked
      properties:
        amount:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendLimitAmount'
            - type: 'null'
        blocked:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendLimitBlocked'
            - type: 'null'
        unlimited:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendLimitUnlimited'
            - type: 'null'
      title: Spend Limit
      type: object
      x-speakeasy-name-override: FundsSpendLimit
    c1.api.funds.v1.SubjectAppLimit:
      description: |-
        SubjectAppLimit is one subject's per-app limit row as the admin plane
         renders it. The subject is named explicitly, unlike MyFundLimit, which is
         always the caller's.
      properties:
        appId:
          description: The C1 App this limit applies to.
          type: string
        controls:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendControls'
            - type: 'null'
        createdAt:
          format: date-time
          type:
            - string
            - 'null'
        deletedAt:
          format: date-time
          type:
            - string
            - 'null'
        tenantId:
          description: The tenantId field.
          type: string
        updatedAt:
          format: date-time
          type:
            - string
            - 'null'
        userId:
          description: Canonical c1.models.user.v2.User id.
          type: string
      title: Subject App Limit
      type: object
      x-speakeasy-name-override: SubjectAppLimit
    c1.api.funds.v1.SpendLimitAmount:
      description: The SpendLimitAmount message.
      properties:
        money:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.Money'
            - type: 'null'
      title: Spend Limit Amount
      type: object
      x-speakeasy-name-override: FundsSpendLimitAmount
    c1.api.funds.v1.SpendLimitBlocked:
      description: The SpendLimitBlocked message.
      title: Spend Limit Blocked
      type: object
      x-speakeasy-name-override: FundsSpendLimitBlocked
    c1.api.funds.v1.SpendLimitUnlimited:
      description: The SpendLimitUnlimited message.
      title: Spend Limit Unlimited
      type: object
      x-speakeasy-name-override: FundsSpendLimitUnlimited
    c1.api.funds.v1.SpendControls:
      description: SpendControls retains coexisting base, extension and suspension state.
      properties:
        extension:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendExtension'
            - type: 'null'
        limit:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendLimit'
            - type: 'null'
        period:
          description: The period field.
          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
        suspension:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendSuspension'
            - type: 'null'
      title: Spend Controls
      type: object
      x-speakeasy-name-override: FundsSpendControls
    c1.api.funds.v1.Money:
      description: Money is a non-negative monetary value used by spending controls.
      properties:
        currencyCode:
          description: ISO 4217 currency code.
          type: string
        nanos:
          description: Fractional nano-units, from zero through 999999999.
          format: int32
          type: integer
        units:
          description: >-
            Whole currency units. The bound keeps nano-unit conversion within
            int64.
          format: int64
          type: string
      title: Money
      type: object
      x-speakeasy-name-override: FundsMoney
    c1.api.funds.v1.SpendExtension:
      description: >-
        SpendExtension replaces the base total temporarily; it is not additive
        credit.
      properties:
        expiresAt:
          format: date-time
          type:
            - string
            - 'null'
        limit:
          oneOf:
            - $ref: '#/components/schemas/c1.api.funds.v1.SpendLimit'
            - type: 'null'
        reason:
          description: The reason field.
          type: string
      title: Spend Extension
      type: object
      x-speakeasy-name-override: FundsSpendExtension
    c1.api.funds.v1.SpendSuspension:
      description: >-
        SpendSuspension preserves the underlying controls while refusing new
        spend.
      properties:
        reason:
          description: The reason field.
          type: string
        suspendedAt:
          format: date-time
          type:
            - string
            - 'null'
      title: Spend Suspension
      type: object
      x-speakeasy-name-override: FundsSpendSuspension
  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

````