> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paywithsoap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Device Ping

> POST /api/v1/device_pings runs the geolocation/IP compliance check. Called from the customer device and authenticates with the client secret, not the API key.

# Create Device Ping

Use this endpoint to record a device location ping for a customer. This endpoint helps verify a customer's location by sending their device's coordinates.

The location data is validated and returns information about the detected geographic location, along with whether the location check passed or failed.

This endpoint authenticates with your **client secret**, not your API key. Call it directly from the client (browser, app, etc.) rather than your server, since Soap needs to see the end user's real IP address to complete the check.

> [!NOTE]
>
> The companion endpoint [Get Latest Geo Check](https://docs.paywithsoap.com/api-reference/api-v1/device_pings/latest_geo_check.md) uses your **API key** instead — it's a server-side call, not a client secret call.

This endpoint authenticates with your **client secret**, not your API key:

```bash theme={null}
Authorization: Bearer YOUR_CLIENT_SECRET
```

Your client secret is in the Dashboard under Developers. It looks like `secret_...`.

It is safe to use from a browser or mobile client, which is required here because Soap needs the end user's real IP address.

Requests with an invalid client secret return `422` with `{"error": "Client secret not found."}`.

> [!NOTE]
>
> **Recent checks are reused.** If the customer has a geo check less than 30 minutes old, Soap returns that check instead of evaluating the coordinates you just sent, and marks it with `"cached": true`. Within that window a changed location is not re-evaluated. If device pings are disabled on your account the endpoint returns `404` with a hint to contact Soap.

```bash Curl theme={null}
curl -X POST 'https://api-sandbox.paywithsoap.com/api/v1/device_pings' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_CLIENT_SECRET' \
--data '{
    "latitude": 37.785834,
    "longitude": -122.406417,
    "customer_id": "cus_vi57KegYgcRqcGHqip8q6UZiqtrwMT870"
}'
```

```javascript JavaScript theme={null}
const fetch = require('node-fetch');

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_CLIENT_SECRET'
  },
  body: JSON.stringify({
    latitude: 37.785834,
    longitude: -122.406417,
    customer_id: 'cus_vi57KegYgcRqcGHqip8q6UZiqtrwMT870'
  })
};

fetch('https://api-sandbox.paywithsoap.com/api/v1/device_pings', options)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
```

```json Response theme={null}
{
  "id": "dp_ETBkCvQztKUrzVeQUypYDB1EtUP7oUUX",
  "geo_check": {
    "country": "USA",
    "id": "gc_8HpqVXHQ7672sFi38yLN9kCMJN1LtiMw",
    "latitude": 37.785834,
    "longitude": -122.406417,
    "municipality": "San Francisco",
    "passed": true,
    "region": "CA",
    "cached": false
  },
  "ip_check": null
}
```


## OpenAPI

````yaml POST /api/v1/device_pings
openapi: 3.1.0
info:
  title: Soap API
  description: >-
    API documentation for Soap - AI-native payments infrastructure for complex,
    compliance-heavy payment flows
  license:
    name: MIT
  version: 1.4.0
servers:
  - url: https://api-sandbox.paywithsoap.com
security:
  - bearerAuth: []
paths:
  /api/v1/device_pings:
    post:
      tags:
        - Device Pings
      summary: Records a device location ping
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                latitude:
                  type: number
                  description: Latitude coordinate of the device
                  example: 37.785834
                longitude:
                  type: number
                  description: Longitude coordinate of the device
                  example: -122.406417
                customer_id:
                  type: string
                  description: Unique identifier for the customer
                  example: cus_vi57KegYgcRqcGHqip8q6UZiqtrwMT870
              required:
                - latitude
                - longitude
                - customer_id
        required: true
      responses:
        '200':
          description: Device ping recorded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  geo_check:
                    type: object
                    description: >-
                      Geo check result for the customer. Null if the check could
                      not be run.
                    properties:
                      id:
                        type: string
                        example: gc_8HpqVXHQ7672sFi38yLN9kCMJN1LtiMw
                      latitude:
                        type: number
                        example: 37.785834
                      longitude:
                        type: number
                        example: -122.406417
                      municipality:
                        type: string
                        example: San Francisco
                        nullable: true
                      region:
                        type: string
                        example: CA
                      country:
                        type: string
                        example: USA
                      passed:
                        type: boolean
                        example: true
                        description: Whether the location is in a state that you support.
                      cached:
                        type: boolean
                        example: false
                        description: >-
                          True when Soap reused the customer's most recent geo
                          check instead of evaluating the submitted coordinates.
                          A geo check less than 30 minutes old is reused, so
                          within that window the returned location may differ
                          from the coordinates you just sent.
                    nullable: true
                  id:
                    type: string
                    example: dp_ETBkCvQztKUrzVeQUypYDB1EtUP7oUUX
                  ip_check:
                    type: object
                    nullable: true
                    example: null
                    description: IP check results (turned off for now)
              example:
                geo_check:
                  country: USA
                  id: gc_8HpqVXHQ7672sFi38yLN9kCMJN1LtiMw
                  latitude: 37.785834
                  longitude: -122.406417
                  municipality: San Francisco
                  passed: true
                  region: CA
                  cached: false
                id: dp_ETBkCvQztKUrzVeQUypYDB1EtUP7oUUX
                ip_check: null
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: The feature is disabled for this account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Not found
                  hint:
                    type: string
                    example: >-
                      Device pings are disabled for this business. Contact Soap
                      to enable them.
        '422':
          description: >-
            Invalid request — a malformed body, an invalid field value, or a
            missing/invalid client secret. This endpoint authenticates with your
            publishable client secret, not your API key. Authentication failures
            return 422, not 401.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - clientSecretAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication using your API key (key_...). Used for every
        endpoint except POST /api/v1/device_pings.
    clientSecretAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication using your business client secret
        (secret_...), sent as Authorization: Bearer YOUR_CLIENT_SECRET. This
        secret is browser-safe and is used only for POST /api/v1/device_pings.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.