---
title: "Generates new budgets for several contracts"
method: POST
path: "/api/v2/contracts/generate"
tags: ["Contracts"]
---

# Generates new budgets for several contracts

`POST /api/v2/contracts/generate`

## Request

- Base URL: `https://developer.productive.io` (the document declares no server; this is the origin it was published from)
- URL: `https://developer.productive.io/api/v2/contracts/generate`
- Auth: none declared

Generates budgets for several contracts in one request. Requires the JSON:API bulk extension
header (`Content-Type: application/vnd.api+json; ext=bulk`); the single-contract endpoint lives
at `/api/v2/contracts/{id}/generate`. Each item may carry its own `generate_until`, and the
request generates at most 36 budgets in total, so it holds at most 36 contracts. Validation is
all or nothing — when any contract is rejected, none of them generate. The generated budget
IDs are returned under `meta.generated_budget_ids`, keyed by contract ID. When generation stops
on a conflict partway through, the contracts before it stay generated and the 409 lists the
budgets generated so far under the same keyed `meta.generated_budget_ids`.

## Request body

- object
  - `data` object[]
    - `attributes` object
      - `generate_until` GenerateUntil (unresolved $ref)
    - `id` string, required: ID of the contract to generate budgets for. A contract may appear only once per request.
    - `type` 'contracts', required

## Response `200`

Contracts with the budgets the request generated, keyed by contract ID

- object
  - `data` object[]
    - `attributes` object
      - `copy_expenses` CopyExpenses (unresolved $ref)
      - `copy_purchase_order_number` CopyPurchaseOrderNumber (unresolved $ref)
      - `ends_on` EndsOn (unresolved $ref)
      - `interval_id` IntervalId (unresolved $ref)
      - `next_occurrence_on` NextOccurrenceOn (unresolved $ref)
      - `starts_on` StartsOn (unresolved $ref)
      - `use_rollover_hours` UseRolloverHours (unresolved $ref)
    - `relationships` object
      - `organization` union: A JSON:API single relationship — links to one related resource or `null`.
        - SingleLinkageNullable
          - `data` Resource, required: A JSON:API resource identifier object containing the resource type and ID.
            - `id` string, required: The unique identifier of the resource.
            - `type` string, required: The resource type name (e.g. `tasks`, `people`, `deals`).
        - NotIncluded: Placeholder for a relationship that was not sideloaded in this response.
          - `meta` object, required: Metadata indicating the sideload status of this relationship.
            - `included` false, required: Whether the related resource was included in the sideloaded data. Always `false` for this variant.
      - `template` union: A JSON:API single relationship — links to one related resource or `null`.
        - SingleLinkageNullable
          - `data` Resource, required: A JSON:API resource identifier object containing the resource type and ID.
            - `id` string, required: The unique identifier of the resource.
            - `type` string, required: The resource type name (e.g. `tasks`, `people`, `deals`).
        - NotIncluded: Placeholder for a relationship that was not sideloaded in this response.
          - `meta` object, required: Metadata indicating the sideload status of this relationship.
            - `included` false, required: Whether the related resource was included in the sideloaded data. Always `false` for this variant.
  - `included` unknown[]
    - unknown
  - `meta` object
    - `generated_budget_ids` object

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `406`: Not Acceptable
- `408`: Request Timeout
- `409`: Conflict
- `415`: Unsupported Media Type
- `422`: Unprocessable Content
- `423`: Locked
- `429`: Too Many Requests
- `500`: Internal Server Error

## Changes

- **2026-11-03** `7dcc2525e812`: 1 warning
  - added the new `project_already_exported` enum value to the `errors/items/code` response property for the response status `409`
- **2026-11-02** `fa3060fd0144`: 3 warning, 9 info
  - added the new `bad_decimal_format` enum value to the `errors/items/code` response property for the response status `422`
  - added the new `non_finite_number` enum value to the `errors/items/code` response property for the response status `422`
  - added the new `null_bytes_in_params` enum value to the `errors/items/code` response property for the response status `422`
  - added the non-success response with the status `400`
  - …8 more
- **2026-10-27** `f11a8740641a`: 1 info
  - endpoint added
  - …this revision’s changelog is incomplete

[Operation history](https://skmtc.dev/productive/apis/api-documentation/changes/api/v2/contracts/generate/post.md)

---

[API](https://skmtc.dev/productive/apis/api-documentation.md) - [All operations](https://skmtc.dev/productive/apis/api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/productive/apis/api-documentation/revisions/e7bdfdf6cba3?raw)
