Skip to content

Import questions from GIFT, Aiken or CSV

POST/v1/organization/{orgId}/learning/workspace/question-bank/import

US Region: https://public-api.sessionboard.com · EU Region: https://public-api-eu.sessionboard.com

Reads a GIFT, Aiken or CSV file (sent as text) and lists every question found as a row, ready or with its problems. Without commit nothing is written. With commit: true the ready rows are added to the bank; rows with problems are only left out when skipInvalid is true, and the answer lists every row not imported with its reason. Up to 1 MB and 500 questions. Requires write:learning. Also at POST /v1/learning/workspace/question-bank/import.

Request example

Terminal window
curl --request POST \
--url 'https://public-api.sessionboard.com/v1/organization/{orgId}/learning/workspace/question-bank/import' \
--header 'x-access-token: <api-token>' \
--header 'Content-Type: application/json' \
--data '{
"text": "<string>",
"format": "gift",
"filename": "<string>",
"tags": [
"<string>"
],
"commit": true,
"skipRows": [
1
],
"skipInvalid": true
}'

Try it

Authorization

Your token stays in this page. It is sent only to the region above and is never saved; it is gone when you leave or reload the page.

Path parameters
Body application/json
POST

Authorizations

  • x-access-tokenstringheader

    Organization API token. Generate from Organization Settings → API Tokens.

  • AuthorizationBearer <token>headeror

    OAuth 2.1 access token. Obtained via the OAuth PKCE flow at /oauth/token.

Send one of these. See Authentication.

Path parameters

  • orgIdstringpathrequired

    Your organization ID. Any other organization returns 404.

Request body

application/jsonrequired

  • textstringrequired

    The file's contents.

    Max length
    1100000
  • formatstring

    Leave out to detect it.

    Allowed values
    "gift", "aiken", "csv"
  • filenamestring
    Max length
    255
  • tagsstring[]

    Added to every question.

    Max items
    10
  • commitboolean
  • skipRowsinteger[]

    Preview rows to leave out.

    Max items
    500
  • skipInvalidboolean

    Import the ready rows when other rows have problems.

{
"text": "<string>",
"format": "gift",
"filename": "<string>",
"tags": [
"<string>"
],
"commit": true,
"skipRows": [
1
],
"skipInvalid": true
}

Responses

200application/json

The preview, or what was imported.

  • successboolean
  • payloadobject
    Show child attributes
    • formatstring
      Allowed values
      "gift", "aiken", "csv"
    • fatalstring

      Why nothing could be read (an empty file, no Question column).

    • summaryobject
      Show child attributes
      • totalinteger
      • readyinteger
      • with_errorsinteger
    • rowsobject[]
      Show child attributes
      • rowinteger
      • lineinteger
      • promptstring | null
      • type_labelstring | null
      • tagsstring[]
      • errorsstring[]
      • warningsstring[]
      • questionobject | null
    • importedinteger
    • not_importedobject[]
      Show child attributes
      • rowinteger
      • promptstring
      • reasonstring

400application/json

A path, query or body value failed validation, or an unknown body property was sent. message names the field. (A source object naming the assistant, with the person's prompt, is accepted on every write and removed before validation.) For an {eventId} path that is not a whole number: error: VALIDATION_ERROR, eventId must be a valid integer.

Gateway errors carry error (a code) and message. Errors from Learning itself carry status, success: false, message, name, and sometimes code (and feature or paused_at).

  • errorstring | object

    The gateway's error code (SCOPE_REQUIRED, ORG_WIDE_TOKEN_REQUIRED, NOT_FOUND, …).

  • messagestring
  • statusinteger
  • successboolean
  • namestring
  • codestring

    FEATURE_NOT_ENABLED, AGENT_WRITES_PAUSED, …

  • featurestring
  • paused_atstring<date-time>

401

Missing, invalid or expired token.

403application/json

  • SCOPE_REQUIRED — the token lacks read:learning (reads) or write:learning (writes). Legacy tokens with no scopes cannot write.
  • ORG_WIDE_TOKEN_REQUIRED — the token is restricted to particular events: "The Learning workspace covers every event and learner in the organization, so this API key (restricted to particular events) cannot use it. Use a key without an event restriction."
  • FEATURE_NOT_ENABLED (feature: lessons_credits) — Learning is not on for the organization.
  • FORBIDDEN — the token's user is not an active member of the organization, or lacks the Lessons permission the operation needs.

Gateway errors carry error (a code) and message. Errors from Learning itself carry status, success: false, message, name, and sometimes code (and feature or paused_at).

  • errorstring | object

    The gateway's error code (SCOPE_REQUIRED, ORG_WIDE_TOKEN_REQUIRED, NOT_FOUND, …).

  • messagestring
  • statusinteger
  • successboolean
  • namestring
  • codestring

    FEATURE_NOT_ENABLED, AGENT_WRITES_PAUSED, …

  • featurestring
  • paused_atstring<date-time>

404application/json

orgId is not your organization (error: NOT_FOUND, message: Organization not found).

Gateway errors carry error (a code) and message. Errors from Learning itself carry status, success: false, message, name, and sometimes code (and feature or paused_at).

  • errorstring | object

    The gateway's error code (SCOPE_REQUIRED, ORG_WIDE_TOKEN_REQUIRED, NOT_FOUND, …).

  • messagestring
  • statusinteger
  • successboolean
  • namestring
  • codestring

    FEATURE_NOT_ENABLED, AGENT_WRITES_PAUSED, …

  • featurestring
  • paused_atstring<date-time>

429application/json

  • The token's request limit (100 requests per 15 minutes per bucket by default — see Rate Limiting). Wait Retry-After seconds.
  • QUOTA_EXCEEDED (writes) — the token's daily write quota (10,000 a day). Resets at midnight UTC.

Gateway errors carry error (a code) and message. Errors from Learning itself carry status, success: false, message, name, and sometimes code (and feature or paused_at).

  • errorstring | object

    The gateway's error code (SCOPE_REQUIRED, ORG_WIDE_TOKEN_REQUIRED, NOT_FOUND, …).

  • messagestring
  • statusinteger
  • successboolean
  • namestring
  • codestring

    FEATURE_NOT_ENABLED, AGENT_WRITES_PAUSED, …

  • featurestring
  • paused_atstring<date-time>
  • Retry-Afterintegerheader

    Seconds to wait before retrying.

Response examples

{
"success": true,
"payload": {
"format": "gift",
"fatal": "<string>",
"summary": {
"total": 123,
"ready": 123,
"with_errors": 123
},
"rows": [
{
"row": 123,
"line": 123,
"prompt": "<string>",
"type_label": "<string>",
"tags": [
"<string>"
],
"errors": [
"<string>"
],
"warnings": [
"<string>"
],
"question": {}
}
],
"imported": 123,
"not_imported": [
{
"row": 123,
"prompt": "<string>",
"reason": "<string>"
}
]
}
}