Skip to main content
Before you can submit a request, you need the Open Notes UUID for the user who authored (or flagged) the post. GET /api/public/v1/user-profiles/lookup performs a reverse-lookup by platform identity and returns the canonical profile. A 404 means the user has no Open Notes profile yet. The server creates one lazily on the first request that references them — you can proceed to Step 3 using the platform user ID directly in requested_by.

Request

curl -X GET "https://api.opennotes.ai/api/public/v1/user-profiles/lookup" \
  -H "Authorization: Bearer <api_key>" \
  -H "X-Adapter-Platform: discourse" \
  -H "X-Adapter-User-Id: 42" \
  -H "X-Adapter-Username: alice" \
  -H "X-Adapter-Trust-Level: 2" \
  -H "X-Adapter-Admin: false" \
  -H "X-Adapter-Moderator: false" \
  -H "X-Adapter-Scope: my-community" \
  -G \
  --data-urlencode "platform=discourse" \
  --data-urlencode "platform_user_id=42" \
  --data-urlencode "provider_scope=my-community"

Query parameters

ParameterRequiredDescription
platformyesIntegration platform identifier, e.g. discourse
platform_user_idyesThe user’s ID on your platform (as a string)
provider_scopeyesYour community-server slug from opennotes_platform_community_server_id
All X-Adapter-* headers are required on every call. See Authentication for the full header reference.

Response

HTTP 200 — profile found:
{
  "jsonapi": { "version": "1.1" },
  "data": {
    "type": "user-profiles",
    "id": "01906b2a-3c1e-7f4d-9a88-d4e1f5c2b7a3",
    "attributes": {
      "platform": "discourse",
      "platform_user_id": "42",
      "display_name": "alice"
    }
  }
}
HTTP 404 — no profile yet; the server will create one when the first request for this user arrives.

What to pass to the next step

Capture data.id — this is the Open Notes user_profile_id. You’ll need it in Step 3 as the requested_by field.

Reference implementation

The Discourse plugin performs this lookup in OpenNotes::UserMapper#fetch_profile:
def fetch_profile(discourse_user)
  @client.get(
    "#{OpenNotes::PUBLIC_API_PREFIX}/user-profiles/lookup",
    params: {
      platform: "discourse",
      platform_user_id: discourse_user.id.to_s,
      provider_scope: SiteSetting.opennotes_platform_community_server_id,
    },
    user: discourse_user,
  )
rescue OpenNotes::ApiError => e
  return nil if e.status == 404
  raise
end
Results are cached in memory for 15 minutes (CACHE_DURATION = 15 * 60) to avoid redundant lookups on every incoming post.

API reference

Full parameter and response schema: GET /api/public/v1/user-profiles/lookup under API Reference → User Profiles.
Next: Step 2 — Identify the community