Parchment Docs

Friends

Friends and social features

Get Friends

Get list of accepted friends

GET
/friends

Response Body

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

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

func main() {
  url := "https://example.com/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/friends/"

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

print(response.text)
Empty

Get Friends Invitations

Get pending friend invitations

GET
/friends/invitations

Query Parameters

directionstring

Response Body

curl -X GET "https://example.com/friends/invitations?direction=incoming"
fetch("https://example.com/friends/invitations?direction=incoming")
package main

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

func main() {
  url := "https://example.com/friends/invitations?direction=incoming"

  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/friends/invitations?direction=incoming"

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

print(response.text)
Empty

Post Friends Invite

Send a friend invitation to a user (local or remote). Remote invitations need the nonce and timestamp the client signed into its v2 FRIEND_INVITE envelope.

POST
/friends/invite

Request Body

application/jsonRequired
handleRequiredstring
Maximum length: 320
signatureRequiredstring

Ed25519 signature over the v2 federation envelope

Maximum length: 256
noncestring

Envelope nonce the client signed

Maximum length: 64
timestampstring

Envelope timestamp the client signed

Maximum length: 40

Response Body

curl -X POST "https://example.com/friends/invite" \
  -H "Content-Type: application/json" \
  -d '{
    "handle": "string",
    "signature": "string",
    "nonce": "string",
    "timestamp": "string"
  }'
const body = JSON.stringify({
  "handle": "string",
  "signature": "string",
  "nonce": "string",
  "timestamp": "string"
})

fetch("https://example.com/friends/invite", {
  body
})
package main

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

func main() {
  url := "https://example.com/friends/invite"
  body := strings.NewReader(`{
    "handle": "string",
    "signature": "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/friends/invite"
body = {
  "handle": "string",
  "signature": "string",
  "nonce": "string",
  "timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Post Friends Invitations By Id Accept

Accept a pending friend invitation. For a remote sender, the signed v2 FRIEND_ACCEPT envelope is forwarded to their server.

POST
/friends/invitations/{id}/accept

Request Body

application/jsonRequired
signatureRequiredstring

Ed25519 signature over the v2 federation envelope

Maximum length: 256
noncestring

Envelope nonce the client signed

Maximum length: 64
timestampstring

Envelope timestamp the client signed

Maximum length: 40

Path Parameters

idRequiredstring

Response Body

curl -X POST "https://example.com/friends/invitations/string/accept" \
  -H "Content-Type: application/json" \
  -d '{
    "signature": "string",
    "nonce": "string",
    "timestamp": "string"
  }'
const body = JSON.stringify({
  "signature": "string",
  "nonce": "string",
  "timestamp": "string"
})

fetch("https://example.com/friends/invitations/string/accept", {
  body
})
package main

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

func main() {
  url := "https://example.com/friends/invitations/string/accept"
  body := strings.NewReader(`{
    "signature": "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/friends/invitations/string/accept"
body = {
  "signature": "string",
  "nonce": "string",
  "timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Post Friends Invitations By Id Reject

Reject a pending friend invitation. For a remote sender, a signed v2 FRIEND_REJECT envelope is forwarded when provided.

POST
/friends/invitations/{id}/reject

Request Body

application/jsonRequired
signaturestring

Ed25519 signature over the v2 federation envelope

Maximum length: 256
noncestring

Envelope nonce the client signed

Maximum length: 64
timestampstring

Envelope timestamp the client signed

Maximum length: 40

Path Parameters

idRequiredstring

Response Body

curl -X POST "https://example.com/friends/invitations/string/reject" \
  -H "Content-Type: application/json" \
  -d '{
    "signature": "string",
    "nonce": "string",
    "timestamp": "string"
  }'
const body = JSON.stringify({
  "signature": "string",
  "nonce": "string",
  "timestamp": "string"
})

fetch("https://example.com/friends/invitations/string/reject", {
  body
})
package main

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

func main() {
  url := "https://example.com/friends/invitations/string/reject"
  body := strings.NewReader(`{
    "signature": "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/friends/invitations/string/reject"
body = {
  "signature": "string",
  "nonce": "string",
  "timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Delete Friends Invitations By Id

Cancel an outgoing friend invitation

DELETE
/friends/invitations/{id}

Path Parameters

idRequiredstring

Response Body

curl -X DELETE "https://example.com/friends/invitations/string"
fetch("https://example.com/friends/invitations/string")
package main

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

func main() {
  url := "https://example.com/friends/invitations/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/friends/invitations/string"

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

print(response.text)
Empty

Delete Friends By Handle

Remove a friend. For a remote friend, pass the signed v2 RELATIONSHIP_REVOKE envelope; without it, or if delivery fails, the revocation is queued for retry.

DELETE
/friends/{handle}

Path Parameters

handleRequiredstring

Query Parameters

revoke_signaturestring
Maximum length: 256
revoke_noncestring
Maximum length: 64
revoke_timestampstring
Maximum length: 40

Response Body

curl -X DELETE "https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string"
fetch("https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string")
package main

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

func main() {
  url := "https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=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/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string"

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

print(response.text)
Empty

Get Friends Resolve By Handle

Resolve a handle to user info (local or remote)

GET
/friends/resolve/{handle}

Path Parameters

handleRequiredstring
Maximum length: 960

Response Body

TypeScript Definitions

Use the response body type in TypeScript.

handleRequiredstring
signingKeyRequiredstring
encryptionKeyRequiredstring
inboxRequiredstring
namestring
picturestring

TypeScript Definitions

Use the response body type in TypeScript.

messageRequiredstring

TypeScript Definitions

Use the response body type in TypeScript.

messageRequiredstring

TypeScript Definitions

Use the response body type in TypeScript.

messageRequiredstring
curl -X GET "https://example.com/friends/resolve/string"
fetch("https://example.com/friends/resolve/string")
package main

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

func main() {
  url := "https://example.com/friends/resolve/string"

  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/friends/resolve/string"

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

print(response.text)
{
  "handle": "string",
  "signingKey": "string",
  "encryptionKey": "string",
  "inbox": "string",
  "name": "string",
  "picture": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}

Post Friends Sync keys

Sync friend public keys and profile from their servers

POST
/friends/sync-keys

Response Body

curl -X POST "https://example.com/friends/sync-keys"
fetch("https://example.com/friends/sync-keys")
package main

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

func main() {
  url := "https://example.com/friends/sync-keys"

  req, _ := http.NewRequest("POST", 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/friends/sync-keys"

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

print(response.text)
Empty