AlmondTill/G3N API

suggestCode

query · in the family Reading your records

What it does

Suggest a code for a record, built from its name — and free to take where codes must be unique.

Suggest a free code for a record from its name. Deterministic, no AI call, nothing metered: the name's words uppercase and join with hyphens (bounded 24 chars; diacritics fold), numbered -2, -3, … when taken. For families whose codes are unique (Organization — unique across the whole platform) every candidate is checked against the same reservation the save enforces, so the answer is free at answer time — a race can still take it before you save, and the save then refuses honestly (CONFLICT/IDENTITY_TAKEN, nothing changes). Families whose codes are freely chosen answer the derivation directly. type must name a code-bearing record family (the declared roster — an unknown family refuses VALIDATION/INVALID); text is the name to derive from (<= 500 chars; must contain a letter or digit). Nothing auto-applies — the answer pre-fills the code input. Requires authentication (user sessions).

Before you call

A signed-in user’s session — the call refuses an API key (AUTHZ/FORBIDDEN).

Capability area: Reading your records — Looking up and listing the records of your organization.

Roles that may call it:

What happens

A drafting assist: the suggestion only fills the code box, and nothing saves until you press Change code. Where codes are unique (an organization’s code is unique across the whole platform) the suggestion is checked against the same register the save enforces — though a code can still be taken by someone else between suggesting and saving, and the save then refuses honestly. No AI is involved.

Arguments

NameTypeRequiredNotes
typeString String!yes
textString String!yes

Returns

SuggestedCode SuggestedCode! — The code suggest's answer: ONE derived code, free against its family's declared uniqueness scope at answer time (a race can still take it before you save — the save then refuses honestly). It pre-fills the code input — nothing auto-applies.

Example request

graphql
query ExampleSuggestCode($type: String!, $text: String!) {
  suggestCode(type: $type, text: $text) {
    suggestion
  }
}

Variables:

json
{
  "type": "<type>",
  "text": "Restock before the weekend."
}

Example response

json
{
  "data": {
    "suggestCode": {
      "suggestion": "<suggestion>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer