superadmin
Package superadmin provides a client for the Memory Superadmin API.
The superadmin client is a non-context client — it requires no org or project context. All methods require superadmin privileges. The client provides platform-wide administration: user, organization, and project management; email, embedding, extraction, document-parsing, and sync job oversight.
Import
Section titled “Import”import "github.com/emergent-company/emergent.memory/apps/server/pkg/sdk/superadmin"Client
Section titled “Client”type Client struct { /* unexported */ }Obtained via sdk.Client.Superadmin. No SetContext call is needed or available.
All endpoints require superadmin role. Calling these methods as a regular user returns
403 Forbidden.
Methods
Section titled “Methods”func (c *Client) GetMe(ctx context.Context) (*SuperadminMeResponse, error)Returns whether the authenticated user has superadmin privileges.
Endpoint: GET /api/superadmin/me
User Management
Section titled “User Management”func (c *Client) ListUsers(ctx context.Context, opts *ListUsersOptions) (*ListUsersResponse, error)func (c *Client) DeleteUser(ctx context.Context, userID string) (*SuccessResponse, error)Endpoints:
GET /api/superadmin/usersDELETE /api/superadmin/users/{userID}
DeleteUser performs a soft-delete.
Organization Management
Section titled “Organization Management”func (c *Client) ListOrganizations(ctx context.Context, opts *PaginationOptions) (*ListOrganizationsResponse, error)func (c *Client) DeleteOrganization(ctx context.Context, orgID string) (*SuccessResponse, error)Endpoints:
GET /api/superadmin/organizationsDELETE /api/superadmin/organizations/{orgID}
Project Management
Section titled “Project Management”func (c *Client) ListProjects(ctx context.Context, opts *ListProjectsOptions) (*ListProjectsResponse, error)func (c *Client) DeleteProject(ctx context.Context, projectID string) (*SuccessResponse, error)Endpoints:
GET /api/superadmin/projectsDELETE /api/superadmin/projects/{projectID}
Email Job Management
Section titled “Email Job Management”func (c *Client) ListEmailJobs(ctx context.Context, opts *ListEmailJobsOptions) (*ListEmailJobsResponse, error)func (c *Client) GetEmailJobPreview(ctx context.Context, jobID string) (*EmailJobPreviewResponse, error)Endpoints:
GET /api/superadmin/email-jobsGET /api/superadmin/email-jobs/{jobID}/preview-json
Embedding Job Management
Section titled “Embedding Job Management”func (c *Client) ListEmbeddingJobs(ctx context.Context, opts *ListEmbeddingJobsOptions) (*ListEmbeddingJobsResponse, error)func (c *Client) DeleteEmbeddingJobs(ctx context.Context, req *DeleteJobsRequest) (*DeleteJobsResponse, error)func (c *Client) CleanupOrphanEmbeddingJobs(ctx context.Context) (*CleanupOrphansResponse, error)Endpoints:
GET /api/superadmin/embedding-jobsPOST /api/superadmin/embedding-jobs/deletePOST /api/superadmin/embedding-jobs/cleanup-orphans
Extraction Job Management
Section titled “Extraction Job Management”func (c *Client) ListExtractionJobs(ctx context.Context, opts *ListExtractionJobsOptions) (*ListExtractionJobsResponse, error)func (c *Client) DeleteExtractionJobs(ctx context.Context, req *DeleteJobsRequest) (*DeleteJobsResponse, error)func (c *Client) CancelExtractionJobs(ctx context.Context, req *CancelJobsRequest) (*CancelJobsResponse, error)Endpoints:
GET /api/superadmin/extraction-jobsPOST /api/superadmin/extraction-jobs/deletePOST /api/superadmin/extraction-jobs/cancel
Document Parsing Job Management
Section titled “Document Parsing Job Management”func (c *Client) ListDocumentParsingJobs(ctx context.Context, opts *ListDocumentParsingJobsOptions) (*ListDocumentParsingJobsResponse, error)func (c *Client) DeleteDocumentParsingJobs(ctx context.Context, req *DeleteJobsRequest) (*DeleteJobsResponse, error)func (c *Client) RetryDocumentParsingJobs(ctx context.Context, req *RetryJobsRequest) (*RetryJobsResponse, error)Endpoints:
GET /api/superadmin/document-parsing-jobsPOST /api/superadmin/document-parsing-jobs/deletePOST /api/superadmin/document-parsing-jobs/retry
Sync Job Management
Section titled “Sync Job Management”func (c *Client) ListSyncJobs(ctx context.Context, opts *ListSyncJobsOptions) (*ListSyncJobsResponse, error)func (c *Client) GetSyncJobLogs(ctx context.Context, jobID string) (*SyncJobLogsResponse, error)func (c *Client) DeleteSyncJobs(ctx context.Context, req *DeleteJobsRequest) (*DeleteJobsResponse, error)func (c *Client) CancelSyncJobs(ctx context.Context, req *CancelJobsRequest) (*CancelJobsResponse, error)Endpoints:
GET /api/superadmin/sync-jobsGET /api/superadmin/sync-jobs/{jobID}/logsPOST /api/superadmin/sync-jobs/deletePOST /api/superadmin/sync-jobs/cancel
PaginationMeta
Section titled “PaginationMeta”type PaginationMeta struct { Page int `json:"page"` Limit int `json:"limit"` Total int `json:"total"` TotalPages int `json:"totalPages"` HasNext bool `json:"hasNext"` HasPrev bool `json:"hasPrev"`}type User struct { ID string `json:"id"` ZitadelUserID string `json:"zitadelUserId"` FirstName *string `json:"firstName,omitempty"` LastName *string `json:"lastName,omitempty"` DisplayName *string `json:"displayName,omitempty"` PrimaryEmail *string `json:"primaryEmail,omitempty"` LastActivityAt *time.Time `json:"lastActivityAt,omitempty"` CreatedAt time.Time `json:"createdAt"` Organizations []UserOrgMembership `json:"organizations"`}UserOrgMembership
Section titled “UserOrgMembership”type UserOrgMembership struct { OrgID string `json:"orgId"` OrgName string `json:"orgName"` Role string `json:"role"` JoinedAt time.Time `json:"joinedAt"`}Organization
Section titled “Organization”type Organization struct { ID string `json:"id"` Name string `json:"name"` MemberCount int `json:"memberCount"` ProjectCount int `json:"projectCount"` CreatedAt time.Time `json:"createdAt"` DeletedAt *time.Time `json:"deletedAt,omitempty"`}Project
Section titled “Project”type Project struct { ID string `json:"id"` Name string `json:"name"` OrganizationID string `json:"organizationId"` OrganizationName string `json:"organizationName"` DocumentCount int `json:"documentCount"` CreatedAt time.Time `json:"createdAt"` DeletedAt *time.Time `json:"deletedAt,omitempty"`}Options types
Section titled “Options types”| Type | Key fields |
|---|---|
ListUsersOptions |
Page, Limit, Search, OrgID |
PaginationOptions |
Page, Limit |
ListProjectsOptions |
Page, Limit, OrgID |
ListEmailJobsOptions |
Page, Limit, Status, Recipient, FromDate, ToDate |
ListEmbeddingJobsOptions |
Page, Limit, Status, HasError, ProjectID, Type ("graph" or "chunk") |
ListExtractionJobsOptions |
Page, Limit, Status, JobType, ProjectID, HasError |
ListDocumentParsingJobsOptions |
Page, Limit, Status, ProjectID, HasError |
ListSyncJobsOptions |
Page, Limit, Status, ProjectID, HasError |
Bulk operation types
Section titled “Bulk operation types”// Bulk deletetype DeleteJobsRequest struct { IDs []string `json:"ids"` Type string `json:"type,omitempty"`}type DeleteJobsResponse struct { Success bool `json:"success"` DeletedCount int `json:"deletedCount"` Message string `json:"message"`}
// Bulk canceltype CancelJobsRequest struct { IDs []string `json:"ids"`}type CancelJobsResponse struct { Success bool `json:"success"` CancelledCount int `json:"cancelledCount"` Message string `json:"message"`}
// Bulk retry (document parsing only)type RetryJobsRequest struct { IDs []string `json:"ids"`}type RetryJobsResponse struct { Success bool `json:"success"` RetriedCount int `json:"retriedCount"` Message string `json:"message"`}Example
Section titled “Example”// Verify superadmin roleme, err := client.Superadmin.GetMe(ctx)if err != nil || !me.IsSuperadmin { log.Fatal("not a superadmin")}
// List failed extraction jobs platform-widehasErr := truejobs, err := client.Superadmin.ListExtractionJobs(ctx, &superadmin.ListExtractionJobsOptions{ HasError: &hasErr, Limit: 50,})if err != nil { log.Fatal(err)}fmt.Printf("Failed extraction jobs: %d / %d total\n", jobs.Stats.Failed, jobs.Stats.Total)
// Cancel all queued jobsvar ids []stringfor _, j := range jobs.Jobs { if j.Status == "queued" { ids = append(ids, j.ID) }}if len(ids) > 0 { result, err := client.Superadmin.CancelExtractionJobs(ctx, &superadmin.CancelJobsRequest{IDs: ids}) if err != nil { log.Fatal(err) } fmt.Printf("Cancelled %d jobs\n", result.CancelledCount)}