Skip to content

Management API

Call Opem from your own server: sync your documentation, read and answer requests, and read the project's usage. Every call carries the project's secret key as Authorization: Bearer sk_…, from the Keys tab of the project's Configuration page, on Professional and Enterprise.

Generated from Opem API 1.0.0 (OpenAPI 3.1.0), the document the API itself publishes at https://support.opem.app/api/openapi.json. The base address is https://support.opem.app.

From Node.js

@opem/node has a typed client for every call below.

server.ts
import { createManagementClient } from "@opem/node";

const opem = createManagementClient({
  secretKey: process.env.OPEM_SECRET_KEY!, // sk_…
});

const { data: open } = await opem.GET(
  "/api/v1/manage/requests",
  {
    params: { query: { status: "open", limit: 25 } },
  },
);

Management

GET/api/v1/manage/project

The key's own project

Responses

  • 200 The project
    The body's 20 fields
    200 body
    FieldTypeRules
    idstring (uuid)None
    namestringNone
    slugstringNone
    environmentstring

    one of "production", "staging", "development"

    referencePrefixstring

    matches ^[A-Z][A-Z0-9]{1,7}$

    allowedOriginsarray of stringNone
    requireIdentityVerificationbooleanNone
    identityVerificationRequiredbooleanNone
    featuresobjectNone
    features.askbooleanNone
    features.requestsbooleanNone
    features.screenshotsbooleanNone
    features.anonymousVisitorsbooleanNone
    features.anonymousAskbooleanNone
    features.hybridSearchbooleanNone
    monthlyCreditCapinteger or null

    at least 0

    realtimeEnabledbooleanNone
    lastSeenAtstring (date-time) or nullNone
    lastSeenOriginstring or null

    matches ^https?:\/\/[A-Za-z0-9.-]+(?::\d{1,5})?$

    createdAtstring (date-time)None
  • 401 unauthenticated
  • 403 plan_limit_reached
  • 429 rate_limited

GET/api/v1/manage/usage

The key's project's usage for a month

Needs the management API entitlement (Professional and Enterprise).

Parameters
FieldInTypeRules
periodoptionalquerystring

matches ^\d{4}-(?:0[1-9]|1[0-2])$

Responses

  • 200 The month's usage
    The body's 16 fields
    200 body
    FieldTypeRules
    periodstring

    matches ^\d{4}-(?:0[1-9]|1[0-2])$

    requestsinteger

    at least 0

    answersPlatforminteger

    at least 0

    creditsPlatforminteger

    at least 0

    answersOwninteger

    at least 0

    uploadBytesinteger

    at least 0

    emailsinteger

    at least 0

    daysarray of objectNone
    days[].datestring (date)None
    days[].requestsinteger

    at least 0

    days[].answersPlatforminteger

    at least 0

    days[].creditsPlatforminteger

    at least 0

    days[].answersOwninteger

    at least 0

    days[].ownTokensIninteger

    at least 0

    days[].ownTokensOutinteger

    at least 0

    days[].ownCostMicrointeger

    at least 0

  • 401 unauthenticated
  • 403 plan_limit_reached
  • 422 validation_failed
  • 429 rate_limited

Knowledge

GET/api/v1/manage/knowledge/documents

The project's documents

Parameters
FieldInTypeRules
cursoroptionalquerystring

at least 1 character, at most 512 characters

limitoptionalqueryinteger

at least 1, at most 100, default 25

Responses

  • 200 A page of documents
    The body's 16 fields
    200 body
    FieldTypeRules
    itemsarray of objectNone
    items[].idstring (uuid)None
    items[].pathstring

    at most 300 characters

    items[].sourcestring

    one of "sync", "upload", "authored", "url"

    items[].titlestringNone
    items[].aboutstring or nullNone
    items[].bytesinteger

    at least 0

    items[].enabledbooleanNone
    items[].pathExcludedbooleanNone
    items[].sectionsinteger

    at least 0

    items[].accessarray of string

    at most 20 items

    items[].tagsarray of string

    at most 10 items

    items[].contentHashstring

    matches ^[a-f0-9]{64}$

    items[].syncedAtstring (date-time) or nullNone
    items[].updatedAtstring (date-time)None
    nextCursorstring or nullNone
  • 401 unauthenticated
  • 403 plan_limit_reached
  • 422 validation_failed
  • 429 rate_limited

PUT/api/v1/manage/knowledge/documents

Sync documents by path

Up to 100 documents of up to 512 KB each. With prune, synced documents whose path is neither sent nor in keepPaths are deleted; uploaded and authored documents never are.

Request body
FieldTypeRules
documentsarray of object

at least 1 item, at most 100 items

documents[].pathstring

at most 300 characters

documents[].contentstringNone
pruneoptionalboolean

default false

keepPathsoptionalarray of string

at most 5000 items, default []

Responses

  • 200 What happened to each path
    The body's 10 fields
    200 body
    FieldTypeRules
    documentsarray of objectNone
    documents[].pathstring

    at most 300 characters

    documents[].statusstring

    one of "created", "updated", "unchanged", "pruned"

    documents[].sectionsinteger

    at least 0

    documents[].issuesarray of objectNone
    documents[].issues[].lineinteger or null

    at least 1

    documents[].issues[].levelstring

    one of "warning", "error", "critical"

    documents[].issues[].idstringNone
    documents[].issues[].messagestringNone
    documents[].replacedSourceoptionalstring

    one of "upload", "authored"

  • 401 unauthenticated
  • 403 plan_limit_reached
  • 422 validation_failed
  • 429 rate_limited

POST/api/v1/manage/knowledge/reindex

Re-parse every document with the current rules

Synchronous: answers once every document of the key's project is re-parsed.

Responses

Requests

GET/api/v1/manage/requests

The key's project's requests

Parameters
FieldInTypeRules
cursoroptionalquerystring

at least 1 character, at most 512 characters

limitoptionalqueryinteger

at least 1, at most 100, default 25

statusoptionalquerystring

one of "open", "sent", "replied", "closed"

kindoptionalquerystring

matches ^[a-z][a-z0-9-]{0,31}$

blockingoptionalquerystring

one of "true", "false"

endUserIdoptionalquerystring (uuid)None
sinceoptionalquerystring (date)None
untiloptionalquerystring (date)None

Responses

  • 200 A page of requests
    The body's 19 fields
    200 body
    FieldTypeRules
    itemsarray of objectNone
    items[].idstring (uuid)None
    items[].referencestring

    matches ^[A-Z][A-Z0-9]{1,7}-[1-9][0-9]{0,9}$

    items[].kindstring

    matches ^[a-z][a-z0-9-]{0,31}$

    items[].statusstring

    one of "sent", "replied", "closed"

    items[].blockingbooleanNone
    items[].previewstring

    at most 200 characters

    items[].unreadbooleanNone
    items[].createdAtstring (date-time)None
    items[].lastActivityAtstring (date-time)None
    items[].endUserobjectNone
    items[].endUser.idstring (uuid)None
    items[].endUser.kindstring

    one of "identified", "anonymous"

    items[].endUser.namestring or nullNone
    items[].endUser.emailstring or nullNone
    items[].endUser.verifiedbooleanNone
    items[].pageUrlstring or nullNone
    nextCursorstring or nullNone
    closedNotShowninteger or null

    at least 0

  • 401 unauthenticated
  • 403 plan_limit_reached
  • 422 validation_failed
  • 429 rate_limited

PATCH/api/v1/manage/requests/{requestId}

Close or reopen a request

Parameters
FieldInTypeRules
requestIdpathstring (uuid)None
Request body
FieldTypeRules
statusstring

one of "closed", "sent"

Responses

  • 200 The request
    The body's 92 fields
    200 body
    FieldTypeRules
    idstring (uuid)None
    referencestring

    matches ^[A-Z][A-Z0-9]{1,7}-[1-9][0-9]{0,9}$

    kindstring

    matches ^[a-z][a-z0-9-]{0,31}$

    statusstring

    one of "sent", "replied", "closed"

    blockingbooleanNone
    previewstring

    at most 200 characters

    unreadbooleanNone
    createdAtstring (date-time)None
    lastActivityAtstring (date-time)None
    endUserobjectNone
    endUser.idstring (uuid)None
    endUser.kindstring

    one of "identified", "anonymous"

    endUser.namestring or nullNone
    endUser.emailstring or nullNone
    endUser.verifiedbooleanNone
    endUser.traitsobjectNone
    endUser.otherRequestsinteger

    at least 0

    endUser.pendingIdentityobject or nullNone
    endUser.pendingIdentity.emailoptionalstring (email)

    at most 320 characters

    endUser.pendingIdentity.nameoptionalstring

    at least 1 character, at most 200 characters

    endUser.pendingIdentity.attemptedAtstring (date-time)None
    pageUrlstring or nullNone
    messagestringNone
    pageTitlestring or nullNone
    errorDigeststring or nullNone
    contextobject or nullNone
    context.pageobjectNone
    context.page.urlstring or null

    at most 2000 characters

    context.page.pathstring or null

    at most 2000 characters

    context.page.titlestring or null

    at most 200 characters

    context.browserobjectNone
    context.browser.userAgentstring or null

    at most 300 characters

    context.browser.languagestring or null

    at most 35 characters

    context.browser.timeZonestring or null

    at most 64 characters

    context.browser.viewportobject or nullNone
    context.browser.viewport.widthinteger

    at least 0, at most 100000

    context.browser.viewport.heightinteger

    at least 0, at most 100000

    context.browser.screenobject or nullNone
    context.browser.screen.widthinteger

    at least 0, at most 100000

    context.browser.screen.heightinteger

    at least 0, at most 100000

    context.browser.pixelRationumber or null

    at least 0, at most 10

    context.errorsarray of object

    at most 10 items

    context.errors[].kindstring

    one of "error", "unhandledrejection", "console"

    context.errors[].messagestring

    at most 500 characters

    context.errors[].sourcestring or null

    at most 2000 characters

    context.errors[].lineinteger or null

    at least 0

    context.errors[].columninteger or null

    at least 0

    context.errors[].stackstring or null

    at most 2000 characters

    context.errors[].atstring (date-time)None
    context.recentPagesarray of object

    at most 10 items

    context.recentPages[].pathstring

    at most 2000 characters

    context.recentPages[].titlestring or null

    at most 200 characters

    context.recentPages[].atstring (date-time)None
    context.extraobjectNone
    assistantAnswerobject or nullNone
    assistantAnswer.answerIdstring (uuid)None
    assistantAnswer.questionstringNone
    assistantAnswer.answerstringNone
    assistantAnswer.readsarray of objectNone
    assistantAnswer.reads[].documentstringNone
    assistantAnswer.reads[].headingstring or nullNone
    assistantAnswer.atstring (date-time)None
    attachmentsarray of objectNone
    attachments[].fileIdstring (uuid)None
    attachments[].namestring

    at most 200 characters

    attachments[].contentTypestring

    at most 100 characters

    attachments[].bytesinteger

    at least 0

    statusChangedAtstring (date-time)None
    repliedAtstring (date-time) or nullNone
    closedAtstring (date-time) or nullNone
    notificationobjectNone
    notification.statusstring

    one of "pending", "sent", "failed", "skipped"

    notification.attemptsinteger

    at least 0

    notification.nextAttemptAtstring (date-time) or nullNone
    messagesarray of objectNone
    messages[].idstring (uuid)None
    messages[].authorstring

    one of "staff", "end_user", "system"

    messages[].authorNamestring or nullNone
    messages[].channelstring

    one of "widget", "dashboard", "email", "api"

    messages[].textstringNone
    messages[].attachmentsarray of objectNone
    messages[].attachments[].fileIdstring (uuid)None
    messages[].attachments[].namestring

    at most 200 characters

    messages[].attachments[].contentTypestring

    at most 100 characters

    messages[].attachments[].bytesinteger

    at least 0

    messages[].createdAtstring (date-time)None
    messages[].directionstring

    one of "inbound", "outbound"

    messages[].senderCheckstring or null

    one of "staff", "reporter", "unverified", null

    messages[].fromAddressstring or nullNone
    messages[].subjectstring or nullNone
    messages[].statusEffectstring

    one of "none", "replied", "reopened", "closed"

    messages[].relaystring

    one of "pending", "sent", "failed", "not_needed"

  • 401 unauthenticated
  • 403 plan_limit_reached
  • 404 not_found
  • 422 validation_failed
  • 429 rate_limited

POST/api/v1/manage/requests/{requestId}/messages

Reply to a request from the customer's server

A staff message on channel api, relayed by email as a dashboard reply would be. The author is named by the first word of authorName only.

Parameters
FieldInTypeRules
requestIdpathstring (uuid)None
Request body
FieldTypeRules
textstring

at least 1 character, at most 5000 characters

authorNamestring

The staff member the reply is from. Only the first word is stored and shown to the person, as their first name, as for every staff reply; a value holding an email address shows as the project's name instead.

at least 1 character, at most 80 characters

closeoptionalboolean

default false

Responses

  • 201 The reply
    The body's 17 fields
    201 body
    FieldTypeRules
    idstring (uuid)None
    authorstring

    one of "staff", "end_user", "system"

    authorNamestring or nullNone
    channelstring

    one of "widget", "dashboard", "email", "api"

    textstringNone
    attachmentsarray of objectNone
    attachments[].fileIdstring (uuid)None
    attachments[].namestring

    at most 200 characters

    attachments[].contentTypestring

    at most 100 characters

    attachments[].bytesinteger

    at least 0

    createdAtstring (date-time)None
    directionstring

    one of "inbound", "outbound"

    senderCheckstring or null

    one of "staff", "reporter", "unverified", null

    fromAddressstring or nullNone
    subjectstring or nullNone
    statusEffectstring

    one of "none", "replied", "reopened", "closed"

    relaystring

    one of "pending", "sent", "failed", "not_needed"

  • 401 unauthenticated
  • 403 plan_limit_reached
  • 404 not_found
  • 422 validation_failed
  • 429 rate_limited

Errors

An error is { error: { code, message, requestId, issues? } } with the status its code gives. issues lists where a body, path or query broke the rules. Quote requestId when you write to us. The codes the management API answers with:

CodeStatusMeaning
unauthenticated401No valid credential for this surface
plan_limit_reached403The plan does not allow this, or a limit is reached
not_found404Nothing with that id in the caller's scope
validation_failed422The request does not match the contract
rate_limited429Too many requests; try again shortly