# Save a report

Saves a new report — a stored QUESTION, never rows, re-read from the records on every run. Body: `name`, `definition` ({source, measures, dimensions, filters, limit}, whose source and field keys come from `get_reports_catalogue`), optional `description`, and `visibility` — `private` (the default) or `tenant` to share it with the whole workspace. For a one-off number nobody needs kept, `post_reports_preview` answers without saving anything.

Access class: `workspace`.

## Endpoint

`POST /v1/reports/views`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "definition": {
      "dimensions": [
        {
          "field": "string"
        }
      ],
      "filters": [
        "string"
      ],
      "measures": [
        {
          "agg": "string",
          "field": "string"
        }
      ],
      "source": "string"
    },
    "description": "string",
    "name": "string",
    "visibility": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "view": {
      "created_at": "string",
      "definition": {
        "dimensions": [
          {
            "field": "string"
          }
        ],
        "filters": [
          "string"
        ],
        "measures": [
          {
            "agg": "string",
            "field": "string"
          }
        ],
        "source": "string"
      },
      "description": "string",
      "id": 1.5,
      "is_system": true,
      "name": "string",
      "owner_user_id": 1.5,
      "updated_at": "string",
      "visibility": "string"
    }
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
