---
title: "Add geolocation"
url: "https://developer.incode.com/api-reference/add-geolocation/"
section: "api-reference"
group: "Geolocation"
version: "v1.1"
status: "live"
endpoint: "POST /omni/add/geolocation"
---
# Add geolocation

`POST /omni/add/geolocation`

Base URL: `https://demo-api.incodesmile.com` — Incode demo environment

Send location to store in database, or send coordinates and fetch location and store it

## Path & query parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `api-version` | header | string | yes |  |

## Request body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `longitude` | number (float) | yes | User's geolocation longitude |
| `latitude` | number (float) | yes | User's geolocation latitude |
| `location` | string |  | User's current location |
| `madminArea` | string |  |  |
| `msubAdminArea` | string |  |  |
| `mlocality` | string |  |  |
| `msubLocality` | string |  |  |
| `mthoroughfare` | string |  |  |
| `msubThoroughfare` | string |  |  |
| `mpostalCode` | string |  |  |
| `mcountryCode` | string |  |  |
| `mcountryName` | string |  |  |

## Responses

### 200

OK

### 400

Bad Request

Response body (`application/json`):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `timestamp` | integer (int64) |  | UTC timestamp in milliseconds |
| `status` | integer (int32) |  | Custom error code or HTTP status code |
| `error` | string |  | HTTP status error |
| `message` | string |  | Custom error message |
| `path` | string |  | Endpoint path |
| `details` | object |  | Custom error details |

## Code samples

Generated from this endpoint's method, path, and the conventional Incode headers. The base URL is the Incode demo environment; replace `<YOUR_API_KEY>` with a key for your region.

### cURL

```bash
curl -X POST https://demo-api.incodesmile.com/omni/add/geolocation \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "api-version: 1.0" \
  -H "Content-Type: application/json" \
  -d '{
    "longitude": 0,
    "latitude": 0,
    "location": "",
    "madminArea": "",
    "msubAdminArea": "",
    "mlocality": "",
    "msubLocality": "",
    "mthoroughfare": "",
    "msubThoroughfare": "",
    "mpostalCode": "",
    "mcountryCode": "",
    "mcountryName": ""
  }'
```

### Node

```js
const res = await fetch("https://demo-api.incodesmile.com/omni/add/geolocation", {
  method: "POST",
  headers: {
      "x-api-key": "<YOUR_API_KEY>",
      "api-version": "1.0",
      "Content-Type": "application/json",
  },
    body: JSON.stringify({
      "longitude": 0,
      "latitude": 0,
      "location": "",
      "madminArea": "",
      "msubAdminArea": "",
      "mlocality": "",
      "msubLocality": "",
      "mthoroughfare": "",
      "msubThoroughfare": "",
      "mpostalCode": "",
      "mcountryCode": "",
      "mcountryName": ""
    }),
});
const data = await res.json();
```

### Python

```python
import requests

headers = {
    "x-api-key": "<YOUR_API_KEY>",
    "api-version": "1.0",
    "Content-Type": "application/json",
}
res = requests.post("https://demo-api.incodesmile.com/omni/add/geolocation", headers=headers, json={
  "longitude": 0,
  "latitude": 0,
  "location": "",
  "madminArea": "",
  "msubAdminArea": "",
  "mlocality": "",
  "msubLocality": "",
  "mthoroughfare": "",
  "msubThoroughfare": "",
  "mpostalCode": "",
  "mcountryCode": "",
  "mcountryName": ""
})
data = res.json()
```

### Java

```java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://demo-api.incodesmile.com/omni/add/geolocation"))
    .header("x-api-key", "<YOUR_API_KEY>")
    .header("api-version", "1.0")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"longitude\": 0,\n  \"latitude\": 0,\n  \"location\": \"\",\n  \"madminArea\": \"\",\n  \"msubAdminArea\": \"\",\n  \"mlocality\": \"\",\n  \"msubLocality\": \"\",\n  \"mthoroughfare\": \"\",\n  \"msubThoroughfare\": \"\",\n  \"mpostalCode\": \"\",\n  \"mcountryCode\": \"\",\n  \"mcountryName\": \"\"\n}"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient()
    .send(req, HttpResponse.BodyHandlers.ofString());
```

### Example response

```json
{
  "success": true,
  "status": "OK"
}
```
