# Crear geocerca - createGeofence

##### <span class="api-method" data-method="POST">POST</span> https://api.service24gps.com/api/v1/createGeofence

Este método permite crear una geocerca de tipo: circular, poligonal o lineal.

<details class="mb-m" id="bkmrk-body-parametersparam"><summary class="text-muted">Ver parámetros de solicitud:</summary>

<div><table class="table" style="width: 809px;"><tbody><tr><th style="width: 146px;">Parámetros</th><th style="width: 370px;">Descripción</th><th style="width: 293px;">Ejemplo</th></tr><tr><td style="width: 146px;">apikey</td><td style="width: 370px;">**(Requerido)** Llave de autorización para uso de los Servicios Web.</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px; color: #3366ff;">25sdsd234234aa93sdsdsd37c70118e72</span></td></tr><tr><td style="width: 146px;">token</td><td style="width: 370px;">**(Requerido)** Token devuelto por el método [**getToken**](https://docs.redgps.com/books/webservice/page/metodo-de-autenticacion-gettoken-7ef).</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px; color: #3366ff;">wfszR/oPIQKjt5HT5NgjDnZ2SAZQ==</span></td></tr><tr><td style="width: 146px;">nombre</td><td style="width: 370px;">**(Requerido)** Nombre con el que se identificará la geocerca dentro de la plataforma.

</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px;"><span style="color: #3366ff;">GeoHome</span></span></td></tr><tr><td style="width: 146px;">puntos

</td><td style="width: 370px;" width="351">**(Requerido)** Punto o puntos que conformarán la geocerca.

</td><td style="width: 293px;"><span style="color: #3366ff;">\[{"lat":-12.087574155453476,"lng":-77.08396062254906},{"lat":-12.087672508218587,"lng":-77.08401560783386},{"lat":-12.087707915205174,"lng":-77.08394654095173},{"lat":-12.087658083148632,"lng":-77.08388954401016},{"lat":-12.087618086359699,"lng":-77.08389893174171},{"lat":-12.08758989189834,"lng":-77.08392508327961},{"lat":-12.08757546682392,"lng":-77.08395726978779}\]</span>

</td></tr><tr><td style="width: 146px;">tipo\_cerca

</td><td style="width: 370px;">**(Requerido)** Indica el tipo de geocerca a crear.

1 = Poligonal o dibujo

2 = Circular

3 = Lineal o ruta.

</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px;"><span style="color: #3366ff;">1</span></span></td></tr><tr><td style="width: 146px;">color

</td><td style="width: 370px;">**(Opcional)** Color con el que se mostrará e identificará la geocerca en la plataforma, en formato RGB hexadecimal.

</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px;"><span style="color: #3366ff;">\#223344</span></span></td></tr><tr><td style="width: 146px;">radio

</td><td style="width: 370px;" width="351">**(Opcional)** Radio en metros que abarcará la geocerca circular.

</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px;"><span style="color: #3366ff;">0 </span></span></td></tr><tr><td style="width: 146px;">limite\_velocidad

</td><td style="width: 370px;" width="351">**(Opcional)** Velocidad máxima (Km/h) permitida en la geocerca.

</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px;"><span style="color: #3366ff;"> 50</span></span></td></tr><tr><td style="width: 146px;">solo\_mi\_usuario

</td><td style="width: 370px;" width="351">**(Opcional)** Indica si la geocerca solo es visible para el usuario que la generó.

1 = Mi usuario

0 = Todos los usuarios

</td><td style="width: 293px;"><span role="presentation" style="padding-right: 0.1px;"><span style="color: #3366ff;">1 </span></span></td></tr></tbody></table>

</div></details>##### Solicitud de ejemplo:

```shell
curl --location --request POST 'https://api.service24gps.com/api/v1/createGeofence' \
--form 'apikey="25sdsd234234aa93sdsdsd37c70118e72"' \
--form 'token="wfszR/oPIQKjt5HT5NgjDnZ2SAZQ=="' \
--form 'nombre="GeoHome"' \
--form 'puntos="[{\"lat\":-12.087574155453476,\"lng\":-77.08396062254906},{\"lat\":-12.087672508218587,\"lng\":-77.08401560783386},{\"lat\":-12.087707915205174,\"lng\":-77.08394654095173},{\"lat\":-12.087658083148632,\"lng\":-77.08388954401016},{\"lat\":-12.087618086359699,\"lng\":-77.08389893174171},{\"lat\":-12.08758989189834,\"lng\":-77.08392508327961},{\"lat\":-12.08757546682392,\"lng\":-77.08395726978779}]"' \
--form 'tipo_cerca="1"' \
--form 'color="#223344"' \
--form 'radio="0"' \
--form 'limite_velocidad="50"' \
--form 'solo_mi_usuario="1"'
```

##### Respuesta de ejemplo:

```JSON
{
    "status": 200,
    "data": ""
}
```