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

# Import Quota Values

> Writes the values of a quota: one row per user and per period. The call checks the body, the URL parameters and the quota before answering, and refuses the whole call when anything is wrong, listing every error. Otherwise it creates an import that writes the rows in the background: a 200 means the import was created, not that the values were written. A value changed by hand in Qobra is kept. Calls made while the import waits join it.

## Overview

This endpoint writes the values of a quota — the target assigned to each
person, for each period. Use it to send the objectives you keep in another tool.

**Use this endpoint for:**

* A routine that pushes the targets of the year, or their changes
* Filling a quota from a planning spreadsheet or a data warehouse
* Clearing the targets of a period

> [!NOTE]
>
> **Writes run in the background.** The call checks your rows and returns an
> `import_id` at once; an import then writes them. A `200` means the import was
> created, not that the values were written: follow it with
> [Fetch import](https://docs.qobra.co/api_reference/v2/endpoints/imports/fetch_import.md).

> [!NOTE]
>
> Only quotas from your company's **live environment** can be written. A
> `quota_id` that belongs to a sandbox environment returns `404 Not Found`.
> Discover valid ids with
> [`GET /v2/data-structures`](https://docs.qobra.co/api_reference/v2/endpoints/discovery/list_data_structures),
> where every quota is listed with `"type": "quota"`.

***

## Your first call

```bash cURL theme={null}
curl --request POST \
  --url 'https://api.qobra.co/v2/quotas/QUOTA_ID/values' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "data": [
      {
        "standard.user": "sarah.johnson@company.com",
        "standard.date": "2026-03-31",
        "standard.value": 120000
      }
    ]
  }'
```

```python Python theme={null}
import requests

url = "https://api.qobra.co/v2/quotas/QUOTA_ID/values"
headers = {"X-API-Key": "YOUR_API_KEY"}
rows = [
    {
        "standard.user": "sarah.johnson@company.com",
        "standard.date": "2026-03-31",
        "standard.value": 120000,
    }
]

response = requests.post(url, headers=headers, json={"data": rows})
import_id = response.json()["import_id"]
```

```javascript JavaScript theme={null}
const url = "https://api.qobra.co/v2/quotas/QUOTA_ID/values";
const rows = [
  {
    "standard.user": "sarah.johnson@company.com",
    "standard.date": "2026-03-31",
    "standard.value": 120000,
  },
];

const response = await fetch(url, {
  method: "POST",
  headers: { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ data: rows }),
});
const { import_id } = await response.json();
```

### Example response

```json theme={null}
{
  "import_id": "6740c3d2a1b2c3d4e5f60718",
  "records_processed": 1
}
```

| Field | What it holds |
| - | - |
| `import_id` | Id of the import that writes the rows. `null` on a dry run |
| `records_processed` | Number of rows this call sent |

***

## One row per person and per period

The body holds a `data` array of 1 to 10,000 rows. Each row is one cell of the
quota: one user, one period. These are the only keys accepted:

| Key | Type | Required | What it holds |
| - | - | - | - |
| `standard.user` | string | Yes | Email of the user |
| `standard.date` | string | Yes | Any date of the period, `YYYY-MM-DD` |
| `standard.value` | number | Yes | The target. `null` only beside `"deleted": true` |
| `deleted` | boolean | No | `true` clears the cell. `false` by default |

Any other key is refused, including the read-only keys of the read:
`standard.id`, `standard.period` and `standard.source`.

The email is the only way to name a user. A row whose email matches no user, or
an archived one, is set aside when the import runs, and the other rows are
written.

***

## Periods follow your company's fiscal year

Send **any date of the period** you write: you never compute its first or last
day. The periods follow the fiscal year set for your company in Qobra. On a
quarterly quota:

| Fiscal year 2026 starts on | Dates that write `2026-Q1` | First date of `2026-Q2` |
| - | - | - |
| January 1, 2026 | `2026-01-01`, `2026-02-15`, `2026-03-31` | `2026-04-01` |
| February 1, 2026 | `2026-02-01`, `2026-03-15`, `2026-04-30` | `2026-05-01` |

A date rather than a period label keeps your routine valid if the frequency of
the quota changes. A period label such as `2026-Q1` is refused.

***

## The value depends on the quota type

`standard.value` is a plain number, whatever the type of the quota:

| Quota type | Send | Not |
| - | - | - |
| `amount` | `120000` | `{ "value": 120000, "currency": "EUR" }` |
| `percentage` | `0.8` | `80` |
| `float` | `42` | `"42"` |

> [!WARNING]
>
> **A percentage is sent as a ratio.** `0.8` means 80%, as in the read.

An amount carries no currency: it takes the currency the quota uses for that
user, as when it is entered in the Qobra app. A text, `NaN` or an infinity is
refused.

***

## From a read to a write

Every row read from
[Fetch quota values](https://docs.qobra.co/api_reference/v2/endpoints/data/fetch_quota_values.md)
carries `standard.date`: send it back as is to write the same cell. The read
returns the user and an amount as objects, the write takes their plain value:

```python theme={null}
rows = [
    {
        "standard.user": row["standard.user"]["email"],
        "standard.date": row["standard.date"],
        "standard.value": (
            row["standard.value"]["value"]
            if isinstance(row["standard.value"], dict)
            else row["standard.value"]
        ),
    }
    for row in values  # the data of GET /v2/quotas/{quota_id}/values
]
```

***

## Clear a value

To clear a cell, send `"deleted": true`. Its `standard.value` is then ignored,
and may be `null`:

```json theme={null}
{
  "data": [
    {
      "standard.user": "michael.chen@company.com",
      "standard.date": "2026-06-30",
      "standard.value": null,
      "deleted": true
    }
  ]
}
```

A `null` value without `"deleted": true` is refused, so an empty cell of your
spreadsheet never clears a target by accident.

`deleted` also reads `1` and `0`, and the texts `"true"`, `"false"`, `"1"` and
`"0"`. `null` reads as `false`.

***

## Check a call with `dry_run`

`?dry_run=true` runs the same checks and returns the same errors, without
importing anything. A call that passes them returns a `200` whose `import_id` is
`null`:

```json theme={null}
{
  "import_id": null,
  "records_processed": 1
}
```

A dry run checks the shape of the call, not its data: an unknown or archived
user only shows in the import.

***

## What the values become

* **A value changed by hand in Qobra is kept.** A value entered by hand in the
  app over a value sent by the API becomes an overwrite: the API does not
  replace it.
* **Only the cells you send are written.** The other values of the quota stay
  as they are.
* **Sending a call again is safe.** A call sent twice writes the same values:
  there is no idempotency key to manage.
* **The last row wins.** When several rows target the same user and period, the
  last one received is written, and the others are set aside.
* **Statements are recomputed.** Once the import is finished, Qobra recomputes
  the statements not yet validated of the users the owner of the API key can
  see.

The values written show `"standard.source": "integration"` in the read. In
Qobra, each import shows in the **Update history** of the **Quotas** page.

***

## Send more than 10,000 rows

A call takes 10,000 rows and a body of 3 MB at most. Beyond either, the call is
refused, never cut: split your rows into several calls.

`debounce`, a number of seconds from 0 to 1,800 and `0` by default, makes the
import wait for the next calls:

```bash theme={null}
curl --request POST \
  --url 'https://api.qobra.co/v2/quotas/QUOTA_ID/values?debounce=30' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data @first_10000_rows.json
```

Three things worth knowing:

* The first call creates the import, which starts after `debounce` seconds.
* The calls made before the import starts join it and return the same
  `import_id`, even when they write other quotas. They do not push its start
  further.
* A call made once the import has started creates a new import.

***

## What this endpoint does not do

* **No user id.** Users are named by email only.
* **No currency.** An amount takes the currency of the quota for its user.
* **No sandbox.** Only quotas of the live environment can be written.
* **No quota fed by another integration.** A quota synchronized from your CRM,
  data warehouse or HRIS returns `409 Conflict`, and so does an archived quota.
* **No result per call.** The import reports on every call it merged, in
  [Fetch import](https://docs.qobra.co/api_reference/v2/endpoints/imports/fetch_import.md).

***

## Errors

| Status | Cause |
| - | - |
| `400` | The body or a URL parameter breaks the rules above, or the call sends more than 10,000 rows |
| `401` | Missing or unknown API key |
| `403` | The public API is not enabled for your company |
| `404` | Unknown id, a sandbox quota, or the id of another data structure |
| `409` | The quota is synchronized by another integration, or archived |
| `413` | The body is over 3 MB |
| `415` | The body is not sent with `Content-Type: application/json` |
| `429` | More than 80 requests per second |

`401`, `403` and `404` keep the format of the read endpoints, and `429` returns
`{"error": "Ratelimit exceeded"}`. Every other error lists what went wrong:

```json theme={null}
{
  "count": 2,
  "errors": [
    {
      "error": "ValidationError",
      "path": ["data", 3, "standard.date"],
      "description": "Expected a date such as 2026-03-31",
      "received": "2026-Q1"
    },
    {
      "error": "ValidationError",
      "path": ["data", 7, "standard.user"],
      "description": "Expected an email",
      "received": "jane.acme.com"
    }
  ]
}
```

| Field | What it holds |
| - | - |
| `count` | Total number of errors |
| `error` | `ValidationError`, `ConflictError`, `PayloadTooLargeError` or `UnsupportedMediaTypeError` |
| `path` | Where the error lies: the row counted from 0, then its key. `["debounce"]` is a URL parameter |
| `description` | What was expected. It never repeats the value |
| `received` | The value received, cut to 100 characters. Absent when the key is missing, `null` when you sent it |

A `400` refuses the whole call and lists every error at once, so you can fix
them all before sending it again: `errors` holds the first 1,000, those of the
URL parameters first.

Some `400` worth knowing:

* **An unknown URL parameter is refused.** A misspelt `dry_run` would otherwise
  import your rows instead of checking them.

* **Above 10,000 rows**, the call gets a single error, whatever its rows hold:

  ```json theme={null}
  {
    "count": 1,
    "errors": [
      {
        "error": "ValidationError",
        "path": ["data"],
        "description": "Too many rows: 12500 received, 10000 maximum per call. Split them into several calls and add a debounce (for example ?debounce=30) so they are imported together."
      }
    ]
  }
  ```

* **A body that is not valid JSON** returns a single error whose `path` is `[]`.


## OpenAPI

````yaml post /v2/quotas/{quota_id}/values
openapi: 3.0.2
info:
  version: 2.0.0
  title: Qobra API v2
  description: >-
    Qobra API v2 - Extract your data with ID-based pagination and flexible
    schema discovery, and import the values of your quotas.
  license:
    name: Proprietary
    url: https://www.qobra.co/terms
servers:
  - url: https://api.qobra.co
    description: Production API
security: []
paths:
  /v2/quotas/{quota_id}/values:
    post:
      tags:
        - public_api
        - v2
        - quotas
      summary: Import Quota Values
      description: >-
        Writes the values of a quota: one row per user and per period. The call
        checks the body, the URL parameters and the quota before answering, and
        refuses the whole call when anything is wrong, listing every error.
        Otherwise it creates an import that writes the rows in the background: a
        200 means the import was created, not that the values were written. A
        value changed by hand in Qobra is kept. Calls made while the import
        waits join it.
      operationId: POST_/v2/quotas/(quota_id)/values
      parameters:
        - name: quota_id
          in: path
          required: true
          schema:
            type: string
            format: ObjectId
          description: ID of a quota, listed with the type 'quota' by /v2/data-structures
        - name: dry_run
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            true checks the call without importing anything: the same errors, or
            a 200 whose import_id is null. Also read from 1 and 0
        - name: debounce
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            maximum: 1800
            default: 0
          description: >-
            Seconds the import created by this call waits before it starts (30
            minutes at most), so that the next calls join it. A call that joins
            an import does not push its start further
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuotaValuesImportBody'
            examples:
              quota-values:
                $ref: '#/components/examples/QuotaValuesImportBodyExample'
      responses:
        '200':
          description: >-
            The call passed every check and its rows were added to an import,
            or, on a dry run, would have been.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportResponse'
              examples:
                import:
                  $ref: '#/components/examples/ImportResponseExample'
                dry-run:
                  $ref: '#/components/examples/DryRunImportResponseExample'
        '400':
          description: >-
            Bad Request - the body or a URL parameter breaks the contract, or
            the call sends more than 10,000 rows
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteErrorResponse'
              examples:
                invalid-rows:
                  $ref: '#/components/examples/WriteValidationErrorResponseExample'
                unknown-parameter:
                  $ref: >-
                    #/components/examples/WriteUnknownParameterErrorResponseExample
                too-many-rows:
                  $ref: '#/components/examples/WriteTooManyRowsErrorResponseExample'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
              examples:
                unauthorized-error:
                  $ref: '#/components/examples/UnauthorizedErrorResponseExample'
        '403':
          description: Forbidden - the public API is not enabled for your company
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorResponse'
              examples:
                forbidden-error:
                  $ref: '#/components/examples/ForbiddenErrorResponseExample'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
              examples:
                not-found-error:
                  $ref: '#/components/examples/NotFoundErrorResponseExample'
        '409':
          description: >-
            Conflict - the quota is synchronized by another integration, or
            archived
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteErrorResponse'
              examples:
                conflict-error:
                  $ref: '#/components/examples/WriteConflictErrorResponseExample'
        '413':
          description: Payload Too Large - the body is over 3 MB
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteErrorResponse'
              examples:
                payload-too-large:
                  $ref: >-
                    #/components/examples/WritePayloadTooLargeErrorResponseExample
        '415':
          description: Unsupported Media Type - the body is not sent as JSON
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteErrorResponse'
              examples:
                unsupported-media-type:
                  $ref: >-
                    #/components/examples/WriteUnsupportedMediaTypeErrorResponseExample
      security:
        - api_key: []
components:
  schemas:
    QuotaValuesImportBody:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/QuotaValueImportRowModel'
          minItems: 1
          maxItems: 10000
          description: >-
            The cells to write, 1 to 10,000 per call. To send more, split them
            across calls with a debounce
      required:
        - data
      additionalProperties: false
    ImportResponse:
      type: object
      description: The import the call joined or created. Nothing is written yet
      properties:
        import_id:
          type: string
          format: ObjectId
          nullable: true
          description: >-
            ID of the import that writes the rows. Calls merged into the same
            import get the same id. null on a dry run, which creates no import
        records_processed:
          type: integer
          description: Number of rows this call sent
      required:
        - import_id
        - records_processed
    WriteErrorResponse:
      type: object
      description: >-
        The errors of a refused write. Every error of the call is found at once,
        and nothing is imported
      properties:
        count:
          type: integer
          description: Total number of errors
        errors:
          type: array
          description: The first 1,000 errors, those of the URL parameters first
          items:
            type: object
            properties:
              error:
                type: string
                enum:
                  - ValidationError
                  - ConflictError
                  - PayloadTooLargeError
                  - UnsupportedMediaTypeError
                description: Family of the error
              path:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: integer
                description: >-
                  Where the error lies: ["data", 3, "standard.date"] is the date
                  of the fourth row, counted from 0; ["debounce"] a URL
                  parameter; [] the body as a whole
              description:
                type: string
                description: >-
                  What was expected. It never repeats the value, so you can
                  match it
              received:
                description: >-
                  The value received, cut to 100 characters. Absent when the key
                  is missing, null when you sent null
            required:
              - error
              - path
              - description
      required:
        - count
        - errors
    UnauthorizedErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        type:
          type: string
          enum:
            - UnauthorizedError
          description: Type of the error
      required:
        - message
        - type
    ForbiddenErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        type:
          type: string
          enum:
            - ForbiddenError
          description: Type of the error
        error:
          type: string
          description: Machine-readable error code
      required:
        - message
        - type
        - error
    NotFoundErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        resource:
          type: string
          description: Resource that caused the error
        type:
          type: string
          enum:
            - NotFoundError
          description: Type of the error
      required:
        - message
        - resource
        - type
    QuotaValueImportRowModel:
      type: object
      description: >-
        One cell to write: one user, one period. A key outside these four is
        refused, standard.period and the other read-only keys of the read
        included
      properties:
        standard.user:
          type: string
          format: email
          description: >-
            Email of the user the target is set for, the only identifier
            accepted. In a row read from GET /v2/quotas/{quota_id}/values, it is
            standard.user.email
        standard.date:
          type: string
          format: date
          description: >-
            Any date of the period to write, YYYY-MM-DD. The periods follow the
            fiscal year set for your company in Qobra
        standard.value:
          type: number
          nullable: true
          description: >-
            The target, a finite number whatever the quota type: 120000 for an
            amount, 0.8 for 80%. No currency: an amount is in the currency of
            the user. null only beside deleted: true
        deleted:
          type: boolean
          default: false
          description: >-
            true clears the cell; its standard.value is then ignored and may be
            null. Also read from 1 and 0, and from the texts "true", "false",
            "1" and "0"; null reads as false
      required:
        - standard.user
        - standard.date
        - standard.value
      additionalProperties: false
  examples:
    QuotaValuesImportBodyExample:
      value:
        data:
          - standard.user: sarah.johnson@company.com
            standard.date: '2026-03-31'
            standard.value: 120000
          - standard.user: michael.chen@company.com
            standard.date: '2026-06-30'
            standard.value: null
            deleted: true
    ImportResponseExample:
      value:
        import_id: 6740c3d2a1b2c3d4e5f60718
        records_processed: 2
    DryRunImportResponseExample:
      value:
        import_id: null
        records_processed: 2
    WriteValidationErrorResponseExample:
      value:
        count: 3
        errors:
          - error: ValidationError
            path:
              - data
              - 0
              - standard.user
            description: Expected an email
            received: sarah.johnson.company.com
          - error: ValidationError
            path:
              - data
              - 0
              - standard.date
            description: Expected a date such as 2026-03-31
            received: 2026-Q1
          - error: ValidationError
            path:
              - data
              - 1
              - standard.value
            description: 'Expected a number, null only beside "deleted": true'
            received: null
    WriteUnknownParameterErrorResponseExample:
      value:
        count: 1
        errors:
          - error: ValidationError
            path:
              - dryrun
            description: Unknown or read-only key
            received: 'true'
    WriteTooManyRowsErrorResponseExample:
      value:
        count: 1
        errors:
          - error: ValidationError
            path:
              - data
            description: >-
              Too many rows: 12500 received, 10000 maximum per call. Split them
              into several calls and add a debounce (for example ?debounce=30)
              so they are imported together.
    UnauthorizedErrorResponseExample:
      value:
        message: You're trying to access resource you're not authorized to.
        type: UnauthorizedError
    ForbiddenErrorResponseExample:
      value:
        message: You don't have permission to access this resource.
        type: ForbiddenError
        error: ForbiddenError
    NotFoundErrorResponseExample:
      value:
        message: We couldn't find the requested resource
        resource: ObjectModel
        type: NotFoundError
    WriteConflictErrorResponseExample:
      value:
        count: 1
        errors:
          - error: ConflictError
            path:
              - quota_id
            description: >-
              The quota is synchronized by another integration, which writes its
              values
    WritePayloadTooLargeErrorResponseExample:
      value:
        count: 1
        errors:
          - error: PayloadTooLargeError
            path: []
            description: >-
              Request body too large: 3 MB maximum per call. Split the rows into
              several calls and add a debounce (for example ?debounce=30) so
              they are imported together.
    WriteUnsupportedMediaTypeErrorResponseExample:
      value:
        count: 1
        errors:
          - error: UnsupportedMediaTypeError
            path: []
            description: >-
              Expected a JSON body, with the header Content-Type:
              application/json
            received: text/plain
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header
      description: Your Qobra API key. Generate it from Settings > API Keys in Qobra.

````