# Create a Report (/docs/v3/4wings/report)



### Create a report of a specified region [#create-a-report-of-a-specified-region]

#### Report - HTTP Request [#report---http-request]

It is possible to call this endpoint using one of these two verbs:

* `POST https://gateway.api.globalfishingwatch.org/v3/4wings/report`

* `GET https://gateway.api.globalfishingwatch.org/v3/4wings/report`

Verb Usage Notes:

* `POST`: Use this method to send a custom polygon. This functionality is not available with the `GET` method.

* `GET`: This method supports caching, which is highly beneficial for frontend/UI applications to prevent redundant requests. Cached requests can be stored and reused, significantly improving response times. Additionally, Global Fishing Watch caches GET requests at the gateway level. If a user is expected to call the same URL multiple times, this can result in a substantial performance improvement.

<Callout type="info">
  This endpoint only supports `geojson` or `region` object in the same request.
</Callout>

<Callout type="info">
  The value of the data of the report is aggregated using the sum function.
</Callout>

> Example 429 Error Response

```json
{
  "statusCode": 429,
  "error": "Too Many Requests",
  "messages": [
    {
      "title": "Too Many Requests",
      "detail": "Your application token is not currently enabled to perform more than one concurrent report. If you need to generate more than one report concurrently, contact us at apis@globalfishingwatch.org",
      "metadata": {
        "currentReportBody": {
          "geojson": null,
          "region": {
            "dataset": "public-mpa-all",
            "id": "555635930"
          }
        },
        "currentReportUrl": "/v3/4wings/report?format=csv&datasets%5B0%5D=public-global-fishing-effort%3Av20201001&date-range=2023-05-01T00%3A00%3A00.000Z%2C2023-06-01T00%3A00%3A00.000Z&spatial-aggregation=true&temporal-resolution=entire&group-by=vessel_id"
      }
    }
  ]
}
```

<Callout type="warn">
  This endpoint only support one report by user at the same time. If you send more than 1 request at
  the same time, you will receive a 429 error. The error contains the information of the current
  executing report for the user.
</Callout>

<Callout type="warn">
  This endpoint could throw a 524 error (Gateway timeout) if the report takes more than 100s in
  obtain the data. In that case, you can recover the report using the endpoint last-report.
</Callout>

#### Report - AIS Apparent Fishing Effort examples [#report---ais-apparent-fishing-effort-examples]

These examples are available:

1. [**Example 1 (POST)**](/docs/examples/report/report-example1) - Generate fishing effort report *grouped By Year* and by *Custom Polygon* In *JSON* Format
2. [**Example 2 (POST)**](/docs/examples/report/report-example2#post) - Generate fishing effort report *grouped By Gear Type*, Using *existing Regions* (Russian Eez) In *CSV* Format.
3. [**Example 3 (GET)**](/docs/examples/report/report-example2#get) - same as Example 2 but using GET.
4. [**Example 4 (POST)**](/docs/examples/report/report-example3#post) - Generate report with total fishing hours per Lat/Lon grid cell (*no grouping*) using *existing Regions* (MPA Dorsal De Nasca) In *JSON* Format
5. [**Example 5 (GET)**](/docs/examples/report/report-example3#get) - same as Example 4 but using GET.
6. [**Example 6 (POST)**](/docs/examples/report/report-example4#post) - Generate report with total fishing hours per Lat/Lon grid cell (*no grouping*) using *existing Regions* (MPA Dorsal De Nasca) In *JSON* Format and buffer of 4 NAUTICAL MILES
7. [**Example 7 (GET)**](/docs/examples/report/report-example4#get) - same as Example 6 but using GET.

#### Report - SAR vessel detection examples [#report---sar-vessel-detection-examples]

These examples are available:

1. [**Example 8 (POST)**](/docs/examples/report/report-example8) - Report REGION ID (Chile) DAILY grided data and filter by unmatched detections (JSON)
2. [**Example 9 (POST)**](/docs/examples/report/report-example9) - Report Indonesia Filter by matched detections - Example of Noisy Vessel

#### Report - AIS Vessel Presence examples [#report---ais-vessel-presence-examples]

These examples are available:

1. [**Example 10 (POST)**](/docs/examples/report/report-example10) - Report vessel presence by region - grouped by vessel type (JSON)
2. [**Example 11 (GET)**](/docs/examples/report/report-example11) - Report vessel presence - cargo and carrier vessels only (JSON)

#### Report - POST [#report---post]

<OpenAPIPage document="apiv3" operations="[{ path: '/v3/4wings/report', method: 'post' }]" hasHead="false" />

#### Report - GET [#report---get]

<OpenAPIPage document="apiv3" operations="[{ path: '/v3/4wings/report', method: 'get' }]" hasHead="false" />

#### 4Wings Report Response Fields [#4wings-report-response-fields]

The 4Wings report endpoint returns different fields depending on the dataset, temporal-resolution, and group-by parameters used in your request.

| Field                 | Type              | Dataset               | Description                                                                                                                                                                                                                                                                                                    |
| --------------------- | ----------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| date                  | string            | All                   | Date or date range for the aggregated data. Format depends on temporal resolution: monthly (YYYY-MM), daily (YYYY-MM-DD), yearly (YYYY), entire (date-range query param value)                                                                                                                                 |
| hours                 | number            | Fishing Effort        | Apparent fishing hours that the vessel associated with this vessel\_id was fishing in the grid cell over the selected time range                                                                                                                                                                               |
| hours                 | number            | Vessel Presence       | Vessel presence hours that the vessel associated with this vessel\_id was present in the grid cell over the selected time range                                                                                                                                                                                |
| detections            | number            | SAR Vessel Detections | Detections present in the grid cell over the selected time range                                                                                                                                                                                                                                               |
| lat                   | number            | All                   | Latitude of the center of the grid cell, in 10ths or 100th of a degree (depending on spatial resolution selection)                                                                                                                                                                                             |
| lon                   | number            | All                   | Longitude of the center of the grid cell, in 10ths or 100th of a degree (depending on spatial resolution selection)                                                                                                                                                                                            |
| vessel\_id            | string            | All                   | A unique vessel identity developed for internal use by Global Fishing Watch and API users, that combines available vessel identifiers such as name, callsign, and Maritime Mobile Service Identity (MMSI). [See more details on vessel id](/docs/v3/general-api-doc/key-concepts#vessel-id)                    |
| vesselIDs             | number            | All                   | Number of different vessel ids in the aggregated data                                                                                                                                                                                                                                                          |
| entryTimestamp        | string (ISO 8601) | All                   | Timestamp when the vessel entered the region within the requested time range                                                                                                                                                                                                                                   |
| exitTimestamp         | string (ISO 8601) | All                   | Timestamp when the vessel exited the region within the requested time range                                                                                                                                                                                                                                    |
| mmsi                  | string            | All                   | Maritime Mobile Service Identity of the vessel, AIS identifier                                                                                                                                                                                                                                                 |
| flag                  | string            | All                   | Flag state (ISO3 value) for the vessel as determined by the first three digits (MID) of the MMSI number. [See more details on flag assignment](/docs/v3/general-api-doc/data-caveats#how-is-a-vessels-flag-assigned-in-apparent-fishing-effort-data)                                                           |
| shipName              | string            | All                   | AIS reported name of the vessel                                                                                                                                                                                                                                                                                |
| geartype              | string            | All                   | Vessel gear types estimated by GFW developed by aggregating available vessel registry records, reported AIS identity information, and estimated classification using machine learning. [See more details on how we identify our gear types here](/docs/v3/general-api-doc/reference-data#gear-types-supported) |
| vessel\_type          | string            | All                   | Vessel types from GFW include fishing vessels, carrier vessels, and support vessels. [See more details on how we identify vessel types here](/docs/v3/general-api-doc/data-caveats#vessel-types)                                                                                                               |
| imo                   | string            | All                   | AIS reported IMO (International Maritime Organization) of the vessel                                                                                                                                                                                                                                           |
| callsign              | string            | All                   | Also known as IRCS (International Radio Call Sign) of the vessel, as reported on AIS                                                                                                                                                                                                                           |
| firstTransmissionDate | string            | All                   | First date when there is a position transmitted on AIS by the vessel                                                                                                                                                                                                                                           |
| lastTransmissionDate  | string            | All                   | Last date when there is a position transmitted on AIS by the vessel                                                                                                                                                                                                                                            |
| dataset               | string            | All                   | Dataset version information when matched with AIS                                                                                                                                                                                                                                                              |

### Get last report generated [#get-last-report-generated]

Get the last report generated. This endpoint allows you to download the last report requested without generating it again. The endpoint only saves the last report for 30 minutes after its generation.

#### Get last report - HTTP Request [#get-last-report---http-request]

`GET https://gateway.api.globalfishingwatch.org/v3/4wings/last-report`

#### Report - Responses [#report---responses]

The endpoint can return 4 different responses depending of the last report status:

* Report running. The report continues executing. It returns a json response with the info of the report running. Example:

```json
{
  "uri": "/v3/4wings/report?format=JSON&datasets%5B0%5D=public-global-fishing-effort%3Av3.0&date-range=2023-12-31T00%3A00%3A00.000Z%2C2024-01-10T00%3A00%3A00.000Z&spatial-aggregation=true&temporal-resolution=ENTIRE&region-dataset=public-eez-areas&group-by=VESSEL_ID",
  "status": "running",
  "lastUpdate": "2024-02-05T13:34:06+0000"
}
```

* Report finished correctly. In this case the response will be the same that the original request sent (See possibles responses of the report endpoint).
* Report finished with error. In this case the response will be a json with the info of the error. Example:

```json
{
  "message": {
    "statusCode": 422,
    "error": "Unprocessable Entity",
    "messages": [
      {
        "title": "region-id",
        "detail": "region-id query param is required"
      }
    ]
  },
  "status": 422
}
```

* Report not found. In this case the endpoint return a 404 error. This can occurr because the last report response is only saved during 30 min after the report finished.
