# F-gas log

The F-gas log under regulation (EU) 2024/573 and the unit's status: CO2 equivalent, the leak check interval and when the next check is due. An entry takes the certificates of the company and of the person and cannot be changed afterwards, only corrected by a new entry. Adding entries needs Maci Service Premium on the unit.

## The f gas entry model

- `id` (string (uuid))
- `unit_id` (string (uuid))
- `type` (string)
- `performed_at` (string (date))
- `refrigerant` (string, nullable)
- `quantity_kg` (number, nullable)
- `reason` (string, nullable)
- `gas_origin` (string, nullable)
- `origin_facility_name` (string, nullable)
- `origin_facility_address` (string, nullable)
- `origin_certificate_no` (string, nullable)
- `method` (string, nullable)
- `result` (string, nullable)
- `leak_location` (string, nullable)
- `description` (string, nullable)
- `disposal` (string, nullable)
- `company_name` (string, nullable)
- `company_cvr` (string, nullable)
- `company_certificate_no` (string, nullable)
- `person_name` (string, nullable)
- `person_certificate_no` (string, nullable)
- `corrects_entry_id` (string (uuid), nullable): The entry this one corrects.
- `is_corrected` (boolean): `true` when a later entry has corrected this one.
- `created_at` (string (date-time))

## The f gas status model

- `unit_id` (string (uuid)): The unit that holds the refrigerant.
- `refrigerant` (string, nullable)
- `covered` (boolean): Whether the unit is covered by leak checks.
- `co2e_tonnes` (number, nullable)
- `interval_months` (integer, nullable): Months between leak checks.
- `last_leak_check_at` (string (date), nullable)
- `next_leak_check_due_at` (string (date), nullable)
- `follow_up_check` (object, nullable): The follow-up check after a repaired leak.
- `state` (string): Where the unit stands towards the next check.
- `detection_system_missing` (boolean): `true` when a leak detection system is required but missing.

## List F-gas entries

`GET /units/{unit}/fgas-entries` · scope `fgas:read`

Entries in the F-gas log.

The logbook is kept on the unit that holds the refrigerant. For a unit on a central system it is the logbook of that system.

### Path parameters

- `unit` (string (uuid), required): The ID of the unit.

### Query parameters

- `limit` (integer): Records per page. At most 100, default 50.
- `cursor` (string): The value of `next_cursor` from the page before.

### Request

```bash
curl https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries \
  -H "Authorization: Bearer $MACI_API_KEY"
```

```javascript
const response = await fetch('https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries', {
  headers: {
    Authorization: `Bearer ${process.env.MACI_API_KEY}`,
  },
});
const data = await response.json();
```

```python
import os
import requests

response = requests.get(
    "https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries",
    headers={"Authorization": f"Bearer {os.environ['MACI_API_KEY']}"},
)
data = response.json()
```

```php
$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries', [
    'headers' => [
        'Authorization' => 'Bearer '.getenv('MACI_API_KEY'),
    ],
]);
$data = json_decode($response->getBody(), true);
```

### Response 200

A page of entries. The fields are those of the f gas entry model.

```json
{
  "data": [
    {
      "id": "e03018b5-1854-47dd-ac3b-1275002c8808",
      "unit_id": "0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11",
      "type": "rum-for-varmt",
      "performed_at": "2026-10-30",
      "refrigerant": "R449A",
      "quantity_kg": 2.5,
      "reason": "Reason",
      "gas_origin": "Gas origin",
      "origin_facility_name": "Example Recovery A/S",
      "origin_facility_address": "Example Road 2, 8000 Aarhus",
      "origin_certificate_no": "R-2207",
      "method": "Method",
      "result": null,
      "leak_location": "Flare nut on the liquid line",
      "description": "Labour",
      "disposal": "Disposal",
      "company_name": "Example Cooling ApS",
      "company_cvr": "12345678",
      "company_certificate_no": "K-4471",
      "person_name": "Jonas L.",
      "person_certificate_no": "P-1182",
      "corrects_entry_id": null,
      "is_corrected": false,
      "created_at": "2026-10-30T09:15:00Z"
    }
  ],
  "next_cursor": null
}
```

## Create F-gas entry

`POST /units/{unit}/fgas-entries` · scope `fgas:write`

New entry in the F-gas log.

Takes the certificates of the company and of the person. An entry cannot be changed afterwards. The unit has to have Premium.

### Path parameters

- `unit` (string (uuid), required): The ID of the unit.

### Headers

- `Idempotency-Key` (string): A value of your own choosing, so that a repeated call does not create two records.

### Body (JSON)

- `type` (string, required) One of `installation`, `top_up`, `recovery`, `leak_check`, `leak_repair`, `detection_system_check`, `decommissioning`.
- `performed_at` (string (date), required): The date of the work.
- `company_name` (string, required): The company that did the work.
- `company_certificate_no` (string, required): The certificate number of the company.
- `person_name` (string, required): The person who did the work.
- `person_certificate_no` (string, required): The certificate number of the person.
- `company_cvr` (string, nullable)
- `refrigerant` (string): The designation of the refrigerant. Needed for `installation` and `top_up`.
- `refrigerant_id` (string (uuid)): Can be used instead of `refrigerant`.
- `quantity_kg` (number): The quantity in kg. Needed for `installation`, `top_up`, `recovery` and `decommissioning`.
- `reason` (string): Needed for `top_up`. One of `service`, `leakage`.
- `gas_origin` (string): Needed for `top_up`. One of `virgin`, `recycled`, `reclaimed`.
- `origin_facility_name` (string): Needed for recycled or reclaimed gas.
- `origin_facility_address` (string): Needed for recycled or reclaimed gas.
- `origin_certificate_no` (string): Needed for recycled or reclaimed gas.
- `method` (string): Needed for `leak_check`. One of `direct`, `indirect`.
- `result` (string): For `leak_check`: `tight` or `leak_found`. For `leak_repair`: `repaired` or `not_repaired`. For `detection_system_check`: `ok` or `fault`.
- `leak_location` (string): Needed when a leak check finds a leak.
- `description` (string): Needed for `leak_repair`.
- `disposal` (string): What happened to the refrigerant. Needed for `decommissioning`.

### Request

```bash
curl -X POST https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries \
  -H "Authorization: Bearer $MACI_API_KEY" \
  -H "Idempotency-Key: a-value-of-your-own" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "installation",
    "performed_at": "2026-10-30",
    "company_name": "Example Cooling ApS",
    "company_certificate_no": "K-4471",
    "person_name": "Jonas L.",
    "person_certificate_no": "P-1182",
    "company_cvr": "12345678",
    "refrigerant": "R449A",
    "refrigerant_id": "2b7c4d1e-9f0a-4b3c-8d6e-5a4f3e2d1c0b",
    "quantity_kg": 2.5,
    "reason": "service",
    "gas_origin": "virgin"
  }'
```

```javascript
const response = await fetch('https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MACI_API_KEY}`,
    'Idempotency-Key': 'a-value-of-your-own',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "type": "installation",
    "performed_at": "2026-10-30",
    "company_name": "Example Cooling ApS",
    "company_certificate_no": "K-4471",
    "person_name": "Jonas L.",
    "person_certificate_no": "P-1182",
    "company_cvr": "12345678",
    "refrigerant": "R449A",
    "refrigerant_id": "2b7c4d1e-9f0a-4b3c-8d6e-5a4f3e2d1c0b",
    "quantity_kg": 2.5,
    "reason": "service",
    "gas_origin": "virgin"
  }),
});
const data = await response.json();
```

```python
import os
import requests

response = requests.post(
    "https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries",
    headers={"Authorization": f"Bearer {os.environ['MACI_API_KEY']}", "Idempotency-Key": "a-value-of-your-own"},
    json={
        "type": "installation",
        "performed_at": "2026-10-30",
        "company_name": "Example Cooling ApS",
        "company_certificate_no": "K-4471",
        "person_name": "Jonas L.",
        "person_certificate_no": "P-1182",
        "company_cvr": "12345678",
        "refrigerant": "R449A",
        "refrigerant_id": "2b7c4d1e-9f0a-4b3c-8d6e-5a4f3e2d1c0b",
        "quantity_kg": 2.5,
        "reason": "service",
        "gas_origin": "virgin"
    },
)
data = response.json()
```

```php
$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-entries', [
    'headers' => [
        'Authorization' => 'Bearer '.getenv('MACI_API_KEY'),
        'Idempotency-Key' => 'a-value-of-your-own',
    ],
    'json' => [
        'type' => 'installation',
        'performed_at' => '2026-10-30',
        'company_name' => 'Example Cooling ApS',
        'company_certificate_no' => 'K-4471',
        'person_name' => 'Jonas L.',
        'person_certificate_no' => 'P-1182',
        'company_cvr' => '12345678',
        'refrigerant' => 'R449A',
        'refrigerant_id' => '2b7c4d1e-9f0a-4b3c-8d6e-5a4f3e2d1c0b',
        'quantity_kg' => 2.5,
        'reason' => 'service',
        'gas_origin' => 'virgin',
    ],
]);
$data = json_decode($response->getBody(), true);
```

### Response 201

The entry that was created. The fields are those of the f gas entry model.

```json
{
  "id": "e03018b5-1854-47dd-ac3b-1275002c8808",
  "unit_id": "0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11",
  "type": "rum-for-varmt",
  "performed_at": "2026-10-30",
  "refrigerant": "R449A",
  "quantity_kg": 2.5,
  "reason": "Reason",
  "gas_origin": "Gas origin",
  "origin_facility_name": "Example Recovery A/S",
  "origin_facility_address": "Example Road 2, 8000 Aarhus",
  "origin_certificate_no": "R-2207",
  "method": "Method",
  "result": null,
  "leak_location": "Flare nut on the liquid line",
  "description": "Labour",
  "disposal": "Disposal",
  "company_name": "Example Cooling ApS",
  "company_cvr": "12345678",
  "company_certificate_no": "K-4471",
  "person_name": "Jonas L.",
  "person_certificate_no": "P-1182",
  "corrects_entry_id": null,
  "is_corrected": false,
  "created_at": "2026-10-30T09:15:00Z"
}
```

## Get F-gas status

`GET /units/{unit}/fgas-status` · scope `fgas:read`

CO2 equivalent, check interval, latest and next leak check.

### Path parameters

- `unit` (string (uuid), required): The ID of the unit.

### Request

```bash
curl https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-status \
  -H "Authorization: Bearer $MACI_API_KEY"
```

```javascript
const response = await fetch('https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-status', {
  headers: {
    Authorization: `Bearer ${process.env.MACI_API_KEY}`,
  },
});
const data = await response.json();
```

```python
import os
import requests

response = requests.get(
    "https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-status",
    headers={"Authorization": f"Bearer {os.environ['MACI_API_KEY']}"},
)
data = response.json()
```

```php
$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.maci.energy/v1/units/0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11/fgas-status', [
    'headers' => [
        'Authorization' => 'Bearer '.getenv('MACI_API_KEY'),
    ],
]);
$data = json_decode($response->getBody(), true);
```

### Response 200

Where the unit stands today. The fields are those of the f gas status model.

```json
{
  "unit_id": "0b6f4c1e-5a1d-4a57-9f0e-2f6f3f0c9a11",
  "refrigerant": "R449A",
  "covered": true,
  "co2e_tonnes": 58.7,
  "interval_months": 6,
  "last_leak_check_at": "2026-10-30",
  "next_leak_check_due_at": "2026-10-30",
  "follow_up_check": null,
  "state": "State",
  "detection_system_missing": false
}
```
