# Put or replace one of the caller's lines

`PUT /api/billing/{account}/relationships/{id}/lines/{product}/{ref}` · Praecise account · Billing

- Callers: The server of a product in the account service's client list.

## Parameters

- `account` (path, required), string: The Praecise account id: `sub` in ID tokens.
- `id` (path, required), string: The relationship's id.
- `product` (path, required), string: The writing product's client id.
- `ref` (path, required), string: The product's own reference.

## Request body

`application/json`

```json
{
  "type": "object",
  "required": [
    "kind",
    "label"
  ],
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "subscription",
        "covered",
        "usage"
      ]
    },
    "covers": {
      "type": "string",
      "description": "For a covered line: the ref of the subscription line that pays for it."
    },
    "label": {
      "type": "string",
      "maxLength": 140
    },
    "labels": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "maxLength": 140
      }
    },
    "plan": {
      "type": "string",
      "maxLength": 60,
      "nullable": true
    },
    "state": {
      "type": "string",
      "enum": [
        "trialing",
        "active",
        "past_due",
        "unpaid",
        "paused",
        "canceled",
        "incomplete",
        "incomplete_expired"
      ],
      "nullable": true
    },
    "period": {
      "type": "object",
      "nullable": true,
      "properties": {
        "start": {
          "type": "string",
          "format": "date-time"
        },
        "end": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "amount": {
      "type": "object",
      "required": [
        "value",
        "currency"
      ],
      "properties": {
        "value": {
          "type": "integer",
          "minimum": 0,
          "description": "Whole minor units."
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        }
      },
      "nullable": true
    },
    "manage_url": {
      "type": "string",
      "format": "uri",
      "nullable": true
    }
  }
}
```

## Responses

- `200`: Replaced, or the same again.
- `201`: New.
- `400`: A field is wrong; the error says which.
- `401`: No valid client id and secret.
- `403`: Another product's line, or an account that has not signed in to the caller.
- `404`: No such account, relationship, line or invoice.
- `409`: Several relationships and none named, a currency that differs, or a closed relationship.
- `429`: Over the limit for a minute. `Retry-After` says when to try again.
- `503`: Billing is not switched on. Nothing to do; do not retry in a loop.

## Example

```sh
curl -X PUT 'https://accounts.praecise.com/api/billing/{account}/relationships/{id}/lines/{product}/{ref}' \
  -H 'Authorization: Basic $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "kind": "subscription",
  "label": "string"
}'
```
