# Export a possession type

`GET /api/v1/possession-types/{possessionType}/export`

Write a possession type out as a file you can import again, here or in another account.

The file holds the structure only: no thing you own and no value you wrote.

This endpoint also answers QUERY, with the same parameters sent in the request body. [How QUERY works](https://my.monicahq.com/docs/api/query-method).

## Path parameters

- `possessionType` (uuid, required): The id of the possession type. A type belonging to somebody else answers 404.

## Returns

The file, as a JSON object. A type belonging to somebody else answers 404.

- `format` (string): Always possession_type.
- `format_version` (integer): The version of the format that wrote the file.
- `possession_type` (object): The type itself.
- `possession_type.name` (string): Its name.
- `possession_type.colour` (string): Its colour.
- `possession_type.icon` (string): Its icon, or null. A file without it imports with no icon; a glyph outside the catalogue is a problem.
- `possession_type.groups` (array): Its groups, in order.
- `possession_type.groups[]` (object): One group.
- `possession_type.groups[].name` (string): The name of the group.
- `possession_type.groups[].fields` (array): The fields of the group, in order.
- `possession_type.groups[].fields[]` (object): One field.
- `possession_type.groups[].fields[].name` (string): The name of the field.
- `possession_type.groups[].fields[].kind` (string): What the field holds.
- `possession_type.groups[].fields[].options` (array): The choices, present on a select field only.
- `possession_type.groups[].fields[].options[]` (string): One choice.
- `possession_type.fields` (array): The fields standing outside any group, in order.
- `possession_type.fields[]` (object): One field.
- `possession_type.fields[].name` (string): The name of the field.
- `possession_type.fields[].kind` (string): What the field holds.
- `possession_type.fields[].options` (array): The choices, present on a select field only.
- `possession_type.fields[].options[]` (string): One choice.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/possession-types/9c1d4e7a-3b52-4f86-a0d9-2e7b6c418f35/export \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/possession-types/9c1d4e7a-3b52-4f86-a0d9-2e7b6c418f35/export', {
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->get('https://my.monicahq.com/api/v1/possession-types/9c1d4e7a-3b52-4f86-a0d9-2e7b6c418f35/export');
```

## Response

`200`

```json
{
    "format": "possession_type",
    "format_version": 1,
    "possession_type": {
        "name": "Office equipment",
        "colour": "#2f7f86",
        "icon": "briefcase",
        "groups": [
            {
                "name": "Purchase",
                "fields": [
                    {
                        "name": "Payment method",
                        "kind": "select",
                        "options": [
                            "Cash",
                            "Card"
                        ]
                    }
                ]
            }
        ],
        "fields": [
            {
                "name": "Condition",
                "kind": "select",
                "options": [
                    "New",
                    "Used",
                    "Broken"
                ]
            },
            {
                "name": "Serial number",
                "kind": "text"
            }
        ]
    }
}
```
