Wikifreedia
All versions

Labels attach short, structured strings to events, pubkeys, relays, or URLs to enable filtering, categorization, and machine-readable annotation. A label namespace (L tag) scopes its labels (l tags) to a defined vocabulary — such as an ISO standard or reverse-domain notation — making them unambiguous and queryable across clients and relays. Labels can be published as standalone Label events targeting any object, or added directly to any event kind for self-reporting.

Label Event (kind:1985)

Assigns one or more labels to a target event, pubkey, addressable event, or relay. Publishers SHOULD limit each event to a single namespace to avoid ambiguity when querying.

Required Tags

Tag Description
l The label value. MUST include a mark (third element) matching the L namespace if present; otherwise ugc is implied.
e / p / a / r Target: event id, pubkey, addressable event (kind:pubkey:d-tag), or relay URL. At least one MUST be present. Relay hints SHOULD be included for e and p tags.

Optional Tags

Tag Description
L Label namespace. RECOMMENDED for searchability; use ISO standards or reverse-domain notation (e.g. ISO-3166-2, com.example). The ugc namespace MAY be used for end-user-provided content. Namespaces starting with # associate the target with the label’s value as a standard nostr tag.

Content

Short, meaningful label strings. Longer discussion or justification for the label goes in content.

Self-Reporting

l and L tags MAY be added to other event kinds to support self-reporting. For events with a kind other than 1985, labels refer to the event itself.

Structured Label Types

For precise, machine-readable labelling, use a well-defined L namespace with l values that follow a consistent format. Each l tag MUST include a mark (third element) matching the L namespace. Below is a summary of known types and the event kinds they apply to.

Type L namespace l value format Event kinds
App capabilities app reads:audio/mpeg, writes:kind:1, alternative:Discord kind:32267, kind:31990, kind:1985
Geographic ISO-3166-2 IT-MI any kind (self-label or kind:1985)
Language ISO-639-1 en any kind (self-label or kind:1985)
Topic #t permies pubkeys, events (kind:1985)

For self-labelling, l and L tags are added directly to the target event. For third-party labelling via kind:1985, use an e, p, a, or r tag to identify the target. When using a tags for addressable events, the format is <kind>:<pubkey>:<d-tag>.

Example events

A suggestion that multiple pubkeys be associated with the permies topic.

{
  "kind": 1985,
  "tags": [
    ["L", "#t"],
    ["l", "permies", "#t"],
    ["p", <pubkey1>, <relay_url>],
    ["p", <pubkey2>, <relay_url>]
  ],
  // other fields...
}

Publishers can self-label by adding l tags to their own non-1985 events. In this case, the kind 1 event’s author is labeling their note as being related to Milan, Italy using ISO 3166-2.

{
  "kind": 1,
  "tags": [
    ["L", "ISO-3166-2"],
    ["l", "IT-MI", "ISO-3166-2"]
  ],
  "content": "It's beautiful here in Milan!",
  // other fields...
}

See Also

  • Protocol — Relay hints for e and p tags

Other authors

No one else has published this topic yet.