Skip to main content
Version: main

Documents API overview

The Documents API manages ServiceNow Document Management: create and link documents, explore folders, stream document content, and manage versions.

Basic usage

Access it through the Now() namespace:

documents := client.Now().Documents()

// Search documents and folders
results, err := documents.Explore().Get(context.Background(), nil)
if err != nil {
log.Fatal(err)
}

// Download a document's content
content, err := documents.Content("{documentSysID}").Get(context.Background(), nil)
if err != nil {
log.Fatal(err)
}

// List a document's versions
versions, err := documents.Versions("{documentSysID}").Get(context.Background(), nil)
if err != nil {
log.Fatal(err)
}

Available operations

  • ExploreExplore().Get(ctx, config) searches documents and folders.
  • CreateCreate().Post(ctx, config) and CreateDocument().Post(ctx, config) create or link documents.
  • ContentContent(documentSysID).Get(ctx, config) streams the raw content ([]byte).
  • VersionsVersions(documentSysID).Get(ctx, config) lists versions; VersionState(versionSysID).Get reads a version's state.
  • AttachAttach(providerID).Post(ctx, config) attaches content to a document.
  • ActionsAction(action).Document(docSysID).Version(versionSysID).Patch(ctx, config) executes a document action.
  • Sync downSyncDown(documentSysID).Post(ctx, config).
  • DeleteDelete().Delete(ctx, config) deletes by query.
Was this page helpful?