# Re-size a purchase nobody has decided yet

> A body naming kind re-sizes a purchase raised as a NewPurchase: its size, term, payment option and offering, looked up again in AWS. Its target and buying account stay as raised (409 for another). A body without kind points a purchase raised from its proposal at another profile or commitment_hourly, sized on today's proposal; naming neither re-sizes the pick it was raised on. Each body fits only its own kind of purchase (409 otherwise). Keeps the id. 404 for an id that is no purchase, 409 once anybody has accepted, rejected or requested it, and 409 for any refusal a raise meets. Answers rebound true. A draft is re-sized by the person who raised it alone (404 for anybody else), which renews its expiry, and 409 purchase_draft_expired once it has expired.

Source: https://docs.levelfour.ai/api-reference/commitments/patch-commitments-purchase-by-id


## PATCH /api/v1/commitments/purchase/{recommendation_id}

A body naming kind re-sizes a purchase raised as a NewPurchase: its size, term, payment option and offering, looked up again in AWS. Its target and buying account stay as raised (409 for another). A body without kind points a purchase raised from its proposal at another profile or commitment_hourly, sized on today's proposal; naming neither re-sizes the pick it was raised on. Each body fits only its own kind of purchase (409 otherwise). Keeps the id. 404 for an id that is no purchase, 409 once anybody has accepted, rejected or requested it, and 409 for any refusal a raise meets. Answers rebound true. A draft is re-sized by the person who raised it alone (404 for anybody else), which renews its expiry, and 409 purchase_draft_expired once it has expired.

### Authentication

Send `Authorization: Bearer <token>`.

### Parameters

- `recommendation_id` (path, string, required)

### Request body

Required. Content type `application/json`.

- Variant 1: object
  - Variant 1: ReservationPurchase
    - `kind` (`reserved_instance`, required)
    - `service` (one of `ec2`, `rds`, `elasticache`, `opensearch`, `redshift`, `memorydb`, required)
    - `region` (string, required)
    - `engine` (string, nullable)
    - `deployment` (one of `single_az`, `multi_az`, nullable)
    - `offering_class` (one of `standard`, `convertible`, nullable)
    - `tenancy` (one of `default`, `dedicated`, nullable)
    - `resource` (string, required)
    - `quantity` (integer, required)
    - `term_months` (one of `12`, `36`, required)
    - `payment_option` (one of `no_upfront`, `partial_upfront`, `all_upfront`, required)
    - `offering_id` (string, nullable)
    - `buying_account_id` (string, required)
  - Variant 2: PlanPurchase
    - `kind` (`savings_plan`, required)
    - `plan_type` (one of `compute`, `database`, `ec2_instance`, required)
    - `instance_family` (string, nullable)
    - `region` (string, nullable)
    - `commitment_hourly` (number, required)
    - `term_months` (one of `12`, `36`, required)
    - `payment_option` (one of `no_upfront`, `partial_upfront`, `all_upfront`, required)
    - `offering_id` (string, nullable)
    - `buying_account_id` (string, required)
- Variant 2: PurchaseSize
  - `profile` (one of `conservative`, `balanced`, `max_savings`, nullable)
  - `commitment_hourly` (number, nullable)

### Responses

#### 200: Successful Response

- `success` (boolean, default `true`)
- `timestamp` (date-time string)
- `data` (object, required)
  - `recommendation_id` (string, required)
  - `payer_account_id` (string, required)
  - `plan_type` (one of `compute`, `database` or `ec2_instance`, nullable, required): Null for a reservation
  - `term_months` (integer, required)
  - `payment_option` (one of `all_upfront`, `partial_upfront`, `no_upfront`, required)
  - `commitment_hourly` (number, nullable, required): Null for a reservation
  - `profile` (one of `conservative`, `balanced`, `max_savings`, nullable, required)
  - `capped_by` (array of string, required)
  - `monthly_savings` (number, required)
  - `grain` (`daily`, nullable, required): Null when no usage was replayed to price the purchase
  - `source` (`cur`, nullable, required)
  - `created_by` (string, nullable)
  - `created_at` (string, required)
  - `rebindable` (boolean, default `false`)
  - `kind` (one of `reserved_instance`, `savings_plan`, nullable): Null on a plan raised from its proposal, before either instrument had terms
  - `origin` (one of `recommended`, `custom`, nullable)
  - `target` (object, nullable): The ReservationTarget or PlanTarget the purchase was raised for
  - `resource` (string, nullable): The class a reservation buys
  - `quantity` (integer, nullable): How many reservations it buys
  - `offering_id` (string, nullable)
  - `quote` (object, nullable): The PurchaseQuoteData it was raised on, without its series
  - `draft` (boolean, default `false`): Raised before anybody asked for a decision on it. A draft is its raiser's alone: out of every list and total until it is accepted or requested
  - `draft_expires_at` (string, nullable): When a draft dies unless it is accepted or requested first. Null for a purchase that is no draft
  - `created` (boolean, default `false`)
  - `rebound` (boolean, default `false`)

#### Errors

- `400`: Bad Request
- `401`: Authentication Error
- `403`: Authorization Error
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Rate Limit Exceeded
- `500`: Internal Server Error

Body of `400`, `401`, `403`, `404`, `409`, `422`, `429`, `500`:

- `success` (`false`, required)
- `error` (object, required)
  - `code` (string, required)
  - `message` (string, required)
  - `details` (any)
- `timestamp` (date-time string, required)
