ONE course:grant
← Receivers

course:grant

course family

A person who owns or administers a course's workspace gives a named learner a seat in that course at no charge (never yourself; an agent key is refused). Enrols them if they are not, seats them in the course's room, and sets or moves the room seat's end date. A paid seat can only be extended. Quiet by default: no subscribe conversion, no email

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
update_group
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
free
What one call costs, so you can budget before acting.
Reversible
yes
The effect can be undone by a later call.
Idempotent
yes
Safe to retry as-is.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/course:grant \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "workspace": <string>, "courseId": <string>, "learner": <string> }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • workspace string required The workspace that owns the course, e.g. `one`. Required: the grant is judged against THIS workspace's owners and admins, never your own
  • courseId string required The course id inside that workspace, e.g. `sold`
  • learner string required The learner's account slug, e.g. `donal`. Must be a person's account (a group or workspace slug is refused as learner_not_found); you cannot grant yourself
  • until string optional ISO date the room seat ends. A bare date (YYYY-MM-DD) means through that day (it ends 00:00 UTC the next day); a full timestamp is used as is. Must be in the future and at most five years ahead. Replaces the included month; a second grant moves it later or earlier, but a PAID seat's end is never set before the month the learner paid for (paid_seat). Once set, an end cannot be cleared back to the included month. Refused for a course that opens no room (lessons never expire). Omit to keep the current end
  • quiet boolean optional Default true: no `subscribe` lifecycle conversion (so no automation or mail fires). false sends the conversion once, for a fresh enrolment only, with the learner as a typed value (it came from the request), so it never moves an existing person's record. The grant itself never sends email

Response

What comes back from the call.

  • ok boolean
  • enrolled boolean true only when THIS call created the enrolment; false when the learner was already enrolled
  • seatUntil string | null When the room seat ends (ISO), or null for a course with no room
  • room string | null The room group the learner was seated in, e.g. `group:sold`, or null
  • seated boolean Whether the room seat landed. false with ok:true means the enrolment and the end date are written but the seat did not land: call again, it is idempotent
  • error string forbidden · agents_cannot_grant · learner_not_found · until_in_past · until_too_far · bad_until · no_room · not_found · refunded · paid_seat · seat_member_removed (an owner removed this person from the room; nothing was written) · unavailable · bad_request
  • reason string Why, for a forbidden or a seat that did not land: not_author · self_grant · act_as · no_caller · seat_failed · seat_unconfigured

Traffic

Every call to course:grant, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names course:grant, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

API route 2
  • one.ie/web/src/lib/act-as.ts:211
  • one.ie/web/src/lib/receiver-index.generated.ts:131
CLI 1
  • packages/cli/src/course.ts:63
→

Answered by

course:grant one.ie/web/src/lib/resolvers/courses.ts:451 Dispatched through POST /api/ask/course:grant, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "type": "string",
      "description": "The workspace that owns the course, e.g. `one`. Required: the grant is judged against THIS workspace's owners and admins, never your own"
    },
    "courseId": {
      "type": "string",
      "description": "The course id inside that workspace, e.g. `sold`"
    },
    "learner": {
      "type": "string",
      "description": "The learner's account slug, e.g. `donal`. Must be a person's account (a group or workspace slug is refused as learner_not_found); you cannot grant yourself"
    },
    "until": {
      "description": "ISO date the room seat ends. A bare date (YYYY-MM-DD) means through that day (it ends 00:00 UTC the next day); a full timestamp is used as is. Must be in the future and at most five years ahead. Replaces the included month; a second grant moves it later or earlier, but a PAID seat's end is never set before the month the learner paid for (paid_seat). Once set, an end cannot be cleared back to the included month. Refused for a course that opens no room (lessons never expire). Omit to keep the current end",
      "type": "string"
    },
    "quiet": {
      "description": "Default true: no `subscribe` lifecycle conversion (so no automation or mail fires). false sends the conversion once, for a fresh enrolment only, with the learner as a typed value (it came from the request), so it never moves an existing person's record. The grant itself never sends email",
      "type": "boolean"
    }
  },
  "required": [
    "workspace",
    "courseId",
    "learner"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "enrolled": {
      "type": "boolean",
      "description": "true only when THIS call created the enrolment; false when the learner was already enrolled"
    },
    "seatUntil": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the room seat ends (ISO), or null for a course with no room"
    },
    "room": {
      "description": "The room group the learner was seated in, e.g. `group:sold`, or null",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "seated": {
      "description": "Whether the room seat landed. false with ok:true means the enrolment and the end date are written but the seat did not land: call again, it is idempotent",
      "type": "boolean"
    },
    "error": {
      "description": "forbidden · agents_cannot_grant · learner_not_found · until_in_past · until_too_far · bad_until · no_room · not_found · refunded · paid_seat · seat_member_removed (an owner removed this person from the room; nothing was written) · unavailable · bad_request",
      "type": "string"
    },
    "reason": {
      "description": "Why, for a forbidden or a seat that did not land: not_author · self_grant · act_as · no_caller · seat_failed · seat_unconfigured",
      "type": "string"
    }
  },
  "required": [
    "ok",
    "enrolled",
    "seatUntil"
  ]
}