Parchment Docs

Location

User location and history

curl -X GET "https://example.com/location/e2ee/config"
fetch("https://example.com/location/e2ee/config")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/location/e2ee/config"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/location/e2ee/config"

response = requests.request("GET", url)

print(response.text)
Empty

Set location sharing configuration for a friend

POST
/location/e2ee/config

Request Body

application/jsonRequired
friendHandleRequiredstring
enabledboolean
refreshIntervalnumber
expiresAtstring

Response Body

curl -X POST "https://example.com/location/e2ee/config" \
  -H "Content-Type: application/json" \
  -d '{
    "friendHandle": "string",
    "enabled": true,
    "refreshInterval": 0,
    "expiresAt": "string"
  }'
const body = JSON.stringify({
  "friendHandle": "string",
  "enabled": true,
  "refreshInterval": 0,
  "expiresAt": "string"
})

fetch("https://example.com/location/e2ee/config", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/location/e2ee/config"
  body := strings.NewReader(`{
    "friendHandle": "string",
    "enabled": true,
    "refreshInterval": 0,
    "expiresAt": "string"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/location/e2ee/config"
body = {
  "friendHandle": "string",
  "enabled": true,
  "refreshInterval": 0,
  "expiresAt": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Disable location sharing with a friend

DELETE
/location/e2ee/config/{friendHandle}

Path Parameters

friendHandleRequiredstring

Response Body

curl -X DELETE "https://example.com/location/e2ee/config/string"
fetch("https://example.com/location/e2ee/config/string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/location/e2ee/config/string"

  req, _ := http.NewRequest("DELETE", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/location/e2ee/config/string"

response = requests.request("DELETE", url)

print(response.text)
Empty

Update location: broadcast to friends and store in history

POST
/location/e2ee/update

Request Body

application/jsonRequired
locationsRequiredarray<object>
historyobject

Response Body

curl -X POST "https://example.com/location/e2ee/update" \
  -H "Content-Type: application/json" \
  -d '{
    "locations": [
      {
        "forFriendHandle": "string",
        "encryptedLocation": "string",
        "nonce": "string"
      }
    ],
    "history": {
      "encryptedLocation": "string",
      "nonce": "string",
      "timestamp": "string"
    }
  }'
const body = JSON.stringify({
  "locations": [
    {
      "forFriendHandle": "string",
      "encryptedLocation": "string",
      "nonce": "string"
    }
  ],
  "history": {
    "encryptedLocation": "string",
    "nonce": "string",
    "timestamp": "string"
  }
})

fetch("https://example.com/location/e2ee/update", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/location/e2ee/update"
  body := strings.NewReader(`{
    "locations": [
      {
        "forFriendHandle": "string",
        "encryptedLocation": "string",
        "nonce": "string"
      }
    ],
    "history": {
      "encryptedLocation": "string",
      "nonce": "string",
      "timestamp": "string"
    }
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/location/e2ee/update"
body = {
  "locations": [
    {
      "forFriendHandle": "string",
      "encryptedLocation": "string",
      "nonce": "string"
    }
  ],
  "history": {
    "encryptedLocation": "string",
    "nonce": "string",
    "timestamp": "string"
  }
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Get encrypted locations from friends

GET
/location/e2ee/friends

Response Body

curl -X GET "https://example.com/location/e2ee/friends"
fetch("https://example.com/location/e2ee/friends")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/location/e2ee/friends"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/location/e2ee/friends"

response = requests.request("GET", url)

print(response.text)
Empty

Get encrypted location history

GET
/location/e2ee/history

Query Parameters

limitnumber

Response Body

curl -X GET "https://example.com/location/e2ee/history?limit=0"
fetch("https://example.com/location/e2ee/history?limit=0")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/location/e2ee/history?limit=0"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/location/e2ee/history?limit=0"

response = requests.request("GET", url)

print(response.text)
Empty