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

# Allocate Concurrency to a Sub-workspace

> Sets how many concurrent calls one sub-workspace may run, taken from the family's capacity (bought on the primary). Allocations across all sub-workspaces cannot exceed the capacity. In an individual-billing family the allocation is also the sub-workspace's hard ceiling; in a common-billing family the ceiling is the family total, so idle capacity flows to whichever sub-workspace is busy.

Set how many concurrent calls one sub-workspace may run. Capacity is bought on the primary; the allocations across all sub-workspaces cannot exceed it.

## When to use

* Giving a newly created sub-workspace its first capacity (it starts at `0` and cannot call until allocated).
* Rebalancing capacity between clients or teams.

## Request parameters

| Parameter          | Type          | Required | Description                                                                          |
| ------------------ | ------------- | -------- | ------------------------------------------------------------------------------------ |
| `sub_workspace_id` | string (path) | Yes      | ID of the sub-workspace.                                                             |
| `concurrency`      | integer       | Yes      | Concurrent calls to allocate, `0` or more. `0` stops the sub-workspace from calling. |

## Integration notes

* Authenticate with the primary workspace's API key.
* The value is absolute, not a delta. Lowering an allocation always succeeds; raising it must fit `family.concurrency_available` from [Get Sub-workspaces](/api-reference/endpoint/sub-workspace/get-sub-workspaces).
* `limit_concurrency` in the response is the persisted ceiling. In an individual-billing family it equals the allocation. In a common-billing family it is the family total, because idle capacity is shared, so it can be larger than `concurrency`.
* This is the only allocation endpoint that applies to common-billing families; money is pooled on the primary there.

## Error responses

* **400**: `Only 30 concurrent calls are available to allocate from the parent workspace (capacity 50, 20 already allocated to other sub-workspaces).` — the allocation does not fit.
* **400**: `Sub-workspaces cannot have their own sub-workspaces.` — the key belongs to a sub-workspace.
* **401**: Invalid or missing API key.
* **403**: `Sub-workspaces are not enabled for this workspace.`
* **404**: `Sub-workspace not found` — no active sub-workspace with this id under your primary.
* **422**: `sub_workspace_id` is not a UUID, or `concurrency` is negative or missing.

## Example

```bash theme={null}
curl --request PATCH "https://prod-api.ringg.ai/ca/api/v0/workspace/sub/b7c1f0e2-4d3a-4a91-9f2e-8c1d5a6b7e30/concurrency" \
  --header "X-API-KEY: $RINGG_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{ "concurrency": 20 }'
```

## Common follow-up

Buy more capacity on the primary when `family.concurrency_available` reaches `0`, then allocate the new slots here.


## OpenAPI

````yaml patch /workspace/sub/{sub_workspace_id}/concurrency
openapi: 3.0.0
info:
  title: Ringg AI API Documentation
  description: >-
    This is the documentation for the Ringg AI APIs. The Ringg AI API follows
    RESTful principles, making it intuitive and easy to integrate with your
    applications. All API requests should be made to the base URL. The API
    accepts and returns data in JSON format. Ensure your requests include the
    appropriate Content-Type header for POST and PATCH requests.
  version: 2.0.0
servers:
  - url: https://prod-api.ringg.ai/ca/api/v0
security: []
tags:
  - name: workspace
    description: Endpoints for managing your workspace.
  - name: agent
    description: Endpoints for managing assistants (agents).
  - name: calling
    description: Endpoints for making and managing calls.
  - name: campaign
    description: Endpoints for managing campaigns.
  - name: analytics
    description: Endpoints for accessing call analytics and performance metrics.
  - name: termination
    description: Endpoints for terminating active calls using different methods.
  - name: knowledgebase
    description: Endpoints for managing knowledge bases.
paths:
  /workspace/sub/{sub_workspace_id}/concurrency:
    patch:
      tags:
        - workspace
      summary: Allocate Concurrency to a Sub-workspace
      description: >-
        Sets how many concurrent calls one sub-workspace may run, taken from the
        family's capacity (bought on the primary). Allocations across all
        sub-workspaces cannot exceed the capacity. In an individual-billing
        family the allocation is also the sub-workspace's hard ceiling; in a
        common-billing family the ceiling is the family total, so idle capacity
        flows to whichever sub-workspace is busy.
      operationId: allocateSubWorkspaceConcurrency
      parameters:
        - name: X-API-KEY
          in: header
          description: >-
            (Required) The API key of the PRIMARY workspace. A sub-workspace's
            key is refused with 400.
          required: true
          schema:
            type: string
            example: 7251cb4b-3373-43a4-844c-b27a1d45e0c9
        - name: sub_workspace_id
          in: path
          required: true
          description: (Required) ID of the sub-workspace.
          schema:
            type: string
            format: uuid
            example: b7c1f0e2-4d3a-4a91-9f2e-8c1d5a6b7e30
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - concurrency
              properties:
                concurrency:
                  type: integer
                  minimum: 0
                  description: >-
                    (Required) Concurrent calls to allocate to this
                    sub-workspace. 0 stops it from calling.
                  example: 20
            example:
              concurrency: 20
      responses:
        '200':
          description: 'Successful Response: The new allocation and the family totals.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Mumbai Collections now has 20 concurrent calls
                  sub_workspace_id:
                    type: string
                    example: b7c1f0e2-4d3a-4a91-9f2e-8c1d5a6b7e30
                  concurrency:
                    type: integer
                    example: 20
                  limit_concurrency:
                    type: integer
                    description: >-
                      The persisted ceiling: equals concurrency in an
                      individual-billing family, the family total in a
                      common-billing family.
                    example: 20
                  primary:
                    type: object
                    properties:
                      id:
                        type: string
                        example: 2f9a1c44-7e88-4bb1-9a01-5d3c2e7f6a11
                      name:
                        type: string
                        example: Acme Collections HQ
                  family:
                    type: object
                    properties:
                      parent_concurrency:
                        type: integer
                        description: Family capacity.
                        example: 50
                      allocated_total:
                        type: integer
                        description: >-
                          Sum of all sub-workspace allocations after this
                          change.
                        example: 20
              example:
                message: Mumbai Collections now has 20 concurrent calls
                sub_workspace_id: b7c1f0e2-4d3a-4a91-9f2e-8c1d5a6b7e30
                concurrency: 20
                limit_concurrency: 20
                primary:
                  id: 2f9a1c44-7e88-4bb1-9a01-5d3c2e7f6a11
                  name: Acme Collections HQ
                family:
                  parent_concurrency: 50
                  allocated_total: 20
        '400':
          description: >-
            Bad Request - The allocation does not fit the family's capacity, or
            the API key belongs to a sub-workspace.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: >-
                      Only 30 concurrent calls are available to allocate from
                      the parent workspace (capacity 50, 20 already allocated to
                      other sub-workspaces).
        '401':
          description: Unauthorized - Invalid or missing API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: 401 Unauthorized
                      message:
                        type: string
                        example: Invalid credentials
        '403':
          description: >-
            Forbidden - Sub-workspaces are not enabled for this workspace, or
            the caller is not an active member of the primary.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Sub-workspaces are not enabled for this workspace.
        '404':
          description: Not Found - No active sub-workspace with this id under the primary.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Sub-workspace not found
        '500':
          description: Internal Server Error - Something went wrong on our end.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: 500 Internal Server Error
                      message:
                        type: string
                        example: An unexpected error occurred on the server.

````