# Ensure a relationship: the one named, the account's only one, or its first

`POST /api/billing/{account}/relationships` · 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.

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string",
      "nullable": true
    },
    "country": {
      "type": "string",
      "nullable": true
    },
    "tax_id": {
      "type": "string",
      "nullable": true
    },
    "currency": {
      "type": "string",
      "nullable": true,
      "description": "Set by the first amount; does not change."
    },
    "state": {
      "type": "string",
      "enum": [
        "open",
        "closed"
      ]
    },
    "processor_ref": {
      "type": "string",
      "description": "The payer at the card processor; only to the product that set it."
    },
    "new": {
      "type": "boolean",
      "description": "Make a further relationship (on the person's word)."
    }
  }
}
```

## Responses

- `200`: It was there.
- `201`: Made now.
- `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 POST 'https://accounts.praecise.com/api/billing/{account}/relationships' \
  -H 'Authorization: Basic $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string",
  "name": "string",
  "country": "string",
  "tax_id": "string",
  "currency": "string",
  "state": "open",
  "processor_ref": "string",
  "new": false
}'
```
