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

# Set Users' Billing Organizations

> Set the billing organization of up to 100 users.

Only the submitted users change. Valid assignments are saved together even
if others are invalid, so a `200` can include failures: always check `failed`.
An error response means nothing was saved. Resending an assignment overwrites
the user's current billing organization and records another audit log entry.

Sets the [billing organization](https://docs.devin.ai/admin/billing/org-acu-limits#billing-organization-attribution) for up to 100 users in one request. Only the users you submit change; the rest of the enterprise is untouched. For one user at a time, the beta [user settings endpoint](https://docs.devin.ai/admin/billing/legacy-user-acu-limits#user-endpoints) also accepts `billing_org_id`.

## Partial success

Valid assignments are saved together even when other rows in the same request are invalid, so a `200` response can include failures. Always read `failed`: each entry names the user, the requested organization, and a `reason`. Those users' billing organizations did not change; fix the rows and resend them.

| `reason` | Meaning |
| - | - |
| `user_not_found` | The user is not a member of the enterprise, directly or through an identity provider group. |
| `org_not_found` | The organization does not belong to the enterprise. |
| `user_not_org_member` | The organization is not the enterprise's primary organization and the user is not a member of it. |

New reasons may be added over time, so treat unknown values as a failure rather than an error.

An error response (`4xx` or `5xx`) means nothing in the request was saved. Requests with no assignments, more than 100 assignments, or the same `user_id` more than once are rejected with `422`.

Resending an assignment overwrites the user's current billing organization and records another audit log entry, so repeated calls are safe but not free.

## Permissions

Requires a [service user](https://docs.devin.ai/api-reference/v3/service-users/members-service-users.md) or [personal access token](https://docs.devin.ai/api-reference/personal-access-tokens.md) with both the `ManageBilling` and `ViewOrganizations` permissions at the enterprise level. `ManageOrganizations` also satisfies `ViewOrganizations`, since it includes it.


## OpenAPI

````yaml v3-openapi.yaml PUT /v3/enterprise/members/users/billing-orgs
openapi: 3.1.0
info:
  description: Devin v3 API with Service User authentication and RBAC
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/members/users/billing-orgs:
    put:
      tags:
        - user-billing-orgs
      summary: Set Users' Billing Organizations
      description: >-
        Set the billing organization of up to 100 users.


        Only the submitted users change. Valid assignments are saved together
        even

        if others are invalid, so a `200` can include failures: always check
        `failed`.

        An error response means nothing was saved. Resending an assignment
        overwrites

        the user's current billing organization and records another audit log
        entry.
      operationId: >-
        handle_update_user_billing_orgs_v3_enterprise_members_users_billing_orgs_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserBillingOrgsUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserBillingOrgsUpdateResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Conflict
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Gone
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unprocessable Content
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Too Many Requests
components:
  schemas:
    UserBillingOrgsUpdateRequest:
      properties:
        assignments:
          description: >-
            Billing organization to set for each user. A user may appear only
            once.
          items:
            $ref: '#/components/schemas/UserBillingOrgAssignmentRequest'
          maxItems: 100
          minItems: 1
          title: Assignments
          type: array
      required:
        - assignments
      title: UserBillingOrgsUpdateRequest
      type: object
    UserBillingOrgsUpdateResponse:
      properties:
        assigned:
          description: Assignments that were applied.
          items:
            $ref: '#/components/schemas/UserBillingOrgAssignmentResponse'
          title: Assigned
          type: array
        failed:
          description: >-
            Assignments that were skipped, with the reason. These users' billing
            organizations did not change.
          items:
            $ref: '#/components/schemas/UserBillingOrgFailureResponse'
          title: Failed
          type: array
      required:
        - assigned
        - failed
      title: UserBillingOrgsUpdateResponse
      type: object
    ProblemDetail:
      description: >-
        RFC 9457 application/problem+json error body for the v3 API.


        detail is retained from the legacy {"detail": ...} body for back-compat;
        the

        other members are additive. errors carries field-level validation
        failures

        (422 only).
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: A human-readable explanation specific to this occurrence.
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Machine-readable code for blocked-action refusals (e.g.
            "user_frozen", "migrated_session").
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Field-level validation errors (422 responses only).
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: A URI reference (the request path) for this occurrence.
          title: Instance
        status:
          description: The HTTP status code.
          title: Status
          type: integer
        title:
          description: A short, human-readable summary of the problem type.
          title: Title
          type: string
        type:
          default: about:blank
          description: A URI reference identifying the problem type.
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
    UserBillingOrgAssignmentRequest:
      properties:
        billing_org_id:
          description: Organization to bill the user's Devin Desktop and CLI usage to.
          title: Billing Org Id
          type: string
        user_id:
          description: ID of the enterprise user.
          title: User Id
          type: string
      required:
        - user_id
        - billing_org_id
      title: UserBillingOrgAssignmentRequest
      type: object
    UserBillingOrgAssignmentResponse:
      properties:
        billing_org_id:
          description: >-
            Organization that the user's Devin Desktop and CLI usage now bills
            to.
          title: Billing Org Id
          type: string
        user_id:
          description: ID of the enterprise user.
          title: User Id
          type: string
      required:
        - user_id
        - billing_org_id
      title: UserBillingOrgAssignmentResponse
      type: object
    UserBillingOrgFailureResponse:
      properties:
        billing_org_id:
          description: Requested billing organization ID.
          title: Billing Org Id
          type: string
        reason:
          $ref: '#/components/schemas/UserBillingOrgFailureReason'
          description: >-
            Why the assignment was skipped. An organization other than the
            enterprise's primary organization requires the user to be a member
            of it. New reasons may be added, so handle unknown values.
        user_id:
          description: ID of the user that was not updated.
          title: User Id
          type: string
      required:
        - user_id
        - billing_org_id
        - reason
      title: UserBillingOrgFailureResponse
      type: object
    UserBillingOrgFailureReason:
      enum:
        - user_not_found
        - org_not_found
        - user_not_org_member
      title: UserBillingOrgFailureReason
      type: string
  securitySchemes:
    bearerAuth:
      description: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.