'saving mapbox polygon coordinates to .geojson

Can the Mapbox GL API get geojson data to external .geojson file?
I use the Mapbox GL API for maps. The user draws the polygon, and send it to contact form in geojson code example:

{   "type": "FeatureCollection",  "features": [
{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          27.66357421875,
          48.48748647988415
        ],
        [
          37.79296875,
          48.004625021133904
        ] }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source