syntax = "v1" info ( title: "img infinite canvas api" desc: "AI design workspace API" author: "img-infinite-canvas" version: "v1" ) type HealthResponse { Status string `json:"status"` Service string `json:"service"` Time string `json:"time"` } type QuickAction { Id string `json:"id"` Label string `json:"label"` Prompt string `json:"prompt"` Icon string `json:"icon"` } type InspirationItem { Id string `json:"id"` Title string `json:"title"` Category string `json:"category"` Description string `json:"description"` Accent string `json:"accent"` } type AuthMethod { Id string `json:"id"` Label string `json:"label"` Provider string `json:"provider"` } type AuthOptionsResponse { Region string `json:"region"` Methods []AuthMethod `json:"methods"` Turnstile AuthTurnstileOptions `json:"turnstile"` } type AuthTurnstileOptions { Enabled bool `json:"enabled"` SiteKey string `json:"siteKey,optional"` } type AuthUser { Id string `json:"id"` Region string `json:"region"` Phone string `json:"phone,optional"` CountryCode string `json:"countryCode,optional"` Email string `json:"email,optional"` Name string `json:"name,optional"` AvatarUrl string `json:"avatarUrl,optional"` } type AuthSessionResponse { Status string `json:"status"` User AuthUser `json:"user"` AccessToken string `json:"accessToken"` ExpiresIn int64 `json:"expiresIn"` RefreshToken string `json:"refreshToken,optional"` RefreshExpiresIn int64 `json:"refreshExpiresIn,optional"` BindingToken string `json:"bindingToken,optional"` BindingExpiresIn int64 `json:"bindingExpiresIn,optional"` } type AuthCodeRequest { Target string `json:"target,optional"` Phone string `json:"phone,optional"` CountryCode string `json:"countryCode,optional"` Email string `json:"email,optional"` Purpose string `json:"purpose,optional"` TurnstileToken string `json:"turnstileToken,optional"` } type AuthCodeResponse { Target string `json:"target"` ExpiresIn int64 `json:"expiresIn"` DevCode string `json:"devCode,optional"` Email *AuthEmailMessage `json:"email,optional"` } type AuthEmailMessage { FromName string `json:"fromName"` FromEmail string `json:"fromEmail"` ToEmail string `json:"toEmail"` Subject string `json:"subject"` Code string `json:"code,optional"` Text string `json:"text,optional"` Html string `json:"html,optional"` } type ChinaSmsLoginRequest { Phone string `json:"phone"` CountryCode string `json:"countryCode,optional"` Code string `json:"code"` } type ChinaPasswordLoginRequest { Phone string `json:"phone"` CountryCode string `json:"countryCode,optional"` Password string `json:"password"` } type WechatAuthURLResponse { AuthUrl string `json:"authUrl"` State string `json:"state"` ExpiresIn int64 `json:"expiresIn"` } type ChinaWechatLoginRequest { Code string `json:"code,optional"` State string `json:"state,optional"` BindingToken string `json:"bindingToken,optional"` Phone string `json:"phone,optional"` CountryCode string `json:"countryCode,optional"` SmsCode string `json:"smsCode,optional"` } type GlobalEmailLoginRequest { Email string `json:"email"` Code string `json:"code"` } type GoogleLoginRequest { IdToken string `json:"idToken"` } type AccountProfileResponse { User AuthUser `json:"user"` } type UpdateAccountProfileRequest { Name string `json:"name,optional"` AvatarUrl string `json:"avatarUrl,optional"` } type AccountDevice { Id string `json:"id"` Online bool `json:"online"` Current bool `json:"current"` DeviceType string `json:"deviceType"` System string `json:"system"` Browser string `json:"browser"` Client string `json:"client"` LastSeenAt string `json:"lastSeenAt"` } type AccountDeviceListResponse { Devices []AccountDevice `json:"devices"` } type AccountDeviceMutationResponse { Removed int64 `json:"removed"` } type ProjectSummary { Id string `json:"id"` UserId string `json:"userId"` Title string `json:"title"` Brief string `json:"brief"` Status string `json:"status"` Thumbnail string `json:"thumbnail"` UpdatedAt string `json:"updatedAt"` } type CanvasViewport { X float64 `json:"x"` Y float64 `json:"y"` K float64 `json:"k"` } type MockupPoint { X float64 `json:"x"` Y float64 `json:"y"` } type MockupMesh { Columns int64 `json:"columns,optional"` Rows int64 `json:"rows,optional"` Points []MockupPoint `json:"points,optional"` } type MockupPlacement { X float64 `json:"x"` Y float64 `json:"y"` Width float64 `json:"width"` Height float64 `json:"height"` } type MockupSurface { TargetId string `json:"targetId,optional"` Polygon []MockupPoint `json:"polygon,optional"` Mesh MockupMesh `json:"mesh,optional"` } type MockupModelMap { DataId string `json:"dataId,omitempty,optional"` Width int64 `json:"width,optional"` Height int64 `json:"height,optional"` Url string `json:"url,omitempty,optional"` Data []float64 `json:"data,optional"` } type MockupCameraIntrinsics { Matrix []float64 `json:"matrix,optional"` } type MockupModel { Version int64 `json:"version,optional"` DepthMap MockupModelMap `json:"depthMap,optional"` DepthScaleMin float64 `json:"depthScaleMin,optional"` DepthScaleMax float64 `json:"depthScaleMax,optional"` ShadeMap MockupModelMap `json:"shadeMap,optional"` SegmentationMap MockupModelMap `json:"segmentationMap,optional"` XOffsetMap MockupModelMap `json:"xOffsetMap,optional"` YOffsetMap MockupModelMap `json:"yOffsetMap,optional"` CameraIntrinsics MockupCameraIntrinsics `json:"cameraIntrinsics,optional"` ColorCorrection string `json:"colorCorrection,optional"` ForegroundImage string `json:"foregroundImage,optional"` } type CanvasNode { Id string `json:"id"` Type string `json:"type"` Title string `json:"title"` X float64 `json:"x"` Y float64 `json:"y"` Width float64 `json:"width"` Height float64 `json:"height"` Content string `json:"content"` Tone string `json:"tone"` Status string `json:"status"` ParentId string `json:"parentId,optional"` LayerRole string `json:"layerRole,optional"` FontSize float64 `json:"fontSize,optional"` FontFamily string `json:"fontFamily,optional"` FontWeight string `json:"fontWeight,optional"` Color string `json:"color,optional"` TextAlign string `json:"textAlign,optional"` LineHeight float64 `json:"lineHeight,optional"` LetterSpacing float64 `json:"letterSpacing,optional"` TextDecoration string `json:"textDecoration,optional"` TextTransform string `json:"textTransform,optional"` Opacity float64 `json:"opacity,optional"` FillColor string `json:"fillColor,optional"` StrokeColor string `json:"strokeColor,optional"` StrokeWidth float64 `json:"strokeWidth,optional"` StrokeStyle string `json:"strokeStyle,optional"` FlipX bool `json:"flipX,optional"` FlipY bool `json:"flipY,optional"` Rotation float64 `json:"rotation,optional"` ImageAdjustments string `json:"imageAdjustments,optional"` MockupSurface MockupSurface `json:"mockupSurface,optional"` MockupModel MockupModel `json:"mockupModel,optional"` MockupSourceContent string `json:"mockupSourceContent,optional"` } type CanvasConnection { Id string `json:"id"` FromNodeId string `json:"fromNodeId"` ToNodeId string `json:"toNodeId"` } type AgentMessage { Id string `json:"id"` Role string `json:"role"` Type string `json:"type,optional"` Title string `json:"title"` Content string `json:"content"` ThreadId string `json:"threadId,optional"` ActionId string `json:"actionId,optional"` StepId string `json:"stepId,optional"` ToolCallId string `json:"toolCallId,optional"` Name string `json:"name,optional"` ToolHint string `json:"toolHint,optional"` Status string `json:"status,optional"` CreatedAt string `json:"createdAt"` } type Project { Id string `json:"id"` UserId string `json:"userId"` Title string `json:"title"` Brief string `json:"brief"` Status string `json:"status"` Thumbnail string `json:"thumbnail"` UpdatedAt string `json:"updatedAt"` Version string `json:"version"` SnapshotId string `json:"snapshotId"` Canvas string `json:"canvas"` LastThreadId string `json:"lastThreadId"` Viewport CanvasViewport `json:"viewport"` Nodes []CanvasNode `json:"nodes"` Connections []CanvasConnection `json:"connections"` Messages []AgentMessage `json:"messages"` } type DashboardResponse { Credits int64 `json:"credits"` QuickActions []QuickAction `json:"quickActions"` Projects []ProjectSummary `json:"projects"` Inspiration []InspirationItem `json:"inspiration"` } type ProjectListResponse { Projects []ProjectSummary `json:"projects"` NextOffset int64 `json:"nextOffset"` HasMore bool `json:"hasMore"` } type ProjectListRequest { Limit int64 `form:"limit,optional"` Offset int64 `form:"offset,optional"` } type ProjectIdRequest { Id string `path:"id"` } type CreateProjectRequest { Title string `json:"title,optional"` Prompt string `json:"prompt,optional"` ImageModel string `json:"imageModel,optional"` ImageSize string `json:"imageSize,optional"` EnableWebSearch bool `json:"enableWebSearch,optional"` AllowEmptyPrompt bool `json:"allowEmptyPrompt,optional"` } type UpdateProjectTitleRequest { Id string `path:"id"` Title string `json:"title"` } type ProjectResponse { Project Project `json:"project"` } type DeleteProjectResponse { Id string `json:"id"` Deleted bool `json:"deleted"` } type DeleteProjectsRequest { Ids []string `json:"ids"` } type DeleteProjectsResponse { Deleted int64 `json:"deleted"` } type ChatHistoryResponse { ProjectId string `json:"projectId"` Messages []AgentMessage `json:"messages"` } type GenerateRequest { Id string `path:"id"` Prompt string `json:"prompt"` Mode string `json:"mode,optional"` ImageModel string `json:"imageModel,optional"` ImageSize string `json:"imageSize,optional"` } type AgentContent { Type string `json:"type"` Text string `json:"text,optional"` TextSource string `json:"textSource,optional"` ImageUrl string `json:"imageUrl,optional"` ImageWidth int64 `json:"imageWidth,optional"` ImageHeight int64 `json:"imageHeight,optional"` } type AgentChatMessage { Role string `json:"role"` Contents []AgentContent `json:"contents"` } type AgentPreferToolCategories { Search []string `json:"SEARCH,optional"` Image []string `json:"IMAGE,optional"` } type AgentToolConfig { PreferToolCategories AgentPreferToolCategories `json:"preferToolCategories,optional"` } type AgentChatRequest { Id string `path:"id"` Messages []AgentChatMessage `json:"messages"` ToolConfig AgentToolConfig `json:"toolConfig,optional"` ThreadId string `json:"threadId,optional"` ThreadIdType int64 `json:"threadIdType,optional"` EnableMultimodalInput int64 `json:"enableMultimodalInput,optional"` EnableWebSearch bool `json:"enableWebSearch,optional"` ImageModel string `json:"imageModel,optional"` ImageSize string `json:"imageSize,optional"` Mode string `json:"mode,optional"` } type AgentThreadResponse { ThreadId string `json:"threadId"` Status string `json:"status"` ThreadIdType int64 `json:"threadIdType"` EventsUrl string `json:"eventsUrl"` Project Project `json:"project"` } type AgentThreadStatusResponse { ThreadId string `json:"threadId"` Status string `json:"status"` ThreadIdType int64 `json:"threadIdType"` } type StopAgentTaskRequest { Id string `path:"id"` ThreadId string `json:"threadId,optional"` } type AgentThreadSummary { AgentThreadId string `json:"agentThreadId"` CoverImageUrl string `json:"coverImageUrl"` Text string `json:"text"` ThreadIdType int64 `json:"threadIdType"` UpdateTimestamp int64 `json:"updateTimestamp"` } type AgentThreadListResponse { ProjectId string `json:"projectId"` Threads []AgentThreadSummary `json:"threads"` } type NormalizedBox { X float64 `json:"x"` Y float64 `json:"y"` Width float64 `json:"width"` Height float64 `json:"height"` } type RecognizeObjectRequest { ImageBase64 string `json:"image_base64,optional"` ImageUrl string `json:"image_url,optional"` BoundingBox NormalizedBox `json:"bounding_box,optional"` BBox NormalizedBox `json:"bbox,optional"` Lang string `json:"lang,optional"` Prompt string `json:"prompt,optional"` } type RecognizeObjectResponse { Id string `json:"id"` Label string `json:"label"` Confidence float64 `json:"confidence"` BBox NormalizedBox `json:"bbox"` } type GeneratorTaskRequest { TaskId string `form:"task_id,optional"` ProjectId string `form:"project_id,optional"` } type GeneratorTaskInputArgs { AspectRatio string `json:"aspect_ratio,optional"` Image []string `json:"image,optional"` ImageUrl string `json:"image_url,optional"` Prompt string `json:"prompt,optional"` Resolution string `json:"resolution,optional"` SrcBox *NormalizedBox `json:"src_box,omitempty,optional"` DstBox *NormalizedBox `json:"dst_box,omitempty,optional"` } type GeneratorTaskSubmitRequest { Cid string `json:"cid,optional"` ProjectId string `json:"project_id,optional"` GeneratorName string `json:"generator_name"` InputArgs GeneratorTaskInputArgs `json:"input_args"` } type GeneratorTaskSubmitData { GeneratorTaskId string `json:"generator_task_id"` } type GeneratorTaskSubmitResponse { Code int64 `json:"code"` Message string `json:"message"` Data GeneratorTaskSubmitData `json:"data"` } type GeneratorTaskPriceDetail { BasePrice int64 `json:"base_price"` ExtInfoForUnitCount string `json:"ext_info_for_unit_count"` GeneratorName string `json:"generator_name"` InputArgs GeneratorTaskInputArgs `json:"input_args"` OutputArgs string `json:"output_args,optional"` SearchKey string `json:"search_key"` TimeVariantPeriod string `json:"time_variant_period"` TotalPrice int64 `json:"total_price"` UnitCount int64 `json:"unit_count"` UnitName string `json:"unit_name"` UnitPrice int64 `json:"unit_price"` } type GeneratorTaskDisableUnlimitedPrice { Balance int64 `json:"balance"` Price int64 `json:"price"` PriceDetail GeneratorTaskPriceDetail `json:"price_detail"` DisableUnlimited bool `json:"disable_unlimited"` } type GeneratorTaskQueueInfo { InQueue bool `json:"in_queue"` Position int64 `json:"position"` TotalQueueCount int64 `json:"total_queue_count"` EstimatedEndTime string `json:"estimated_end_time"` RemainingTimeSeconds int64 `json:"remaining_time_seconds"` DisableUnlimitedPrice GeneratorTaskDisableUnlimitedPrice `json:"disable_unlimited_price"` } type GeneratorTaskArtifactMetadata { ArtifactId string `json:"artifact_id,optional"` Format string `json:"format,optional"` Height int64 `json:"height,optional"` Label string `json:"label,optional"` NodeId string `json:"node_id,optional"` NodeName string `json:"node_name,optional"` SizeBytes int64 `json:"size_bytes,optional"` Width int64 `json:"width,optional"` } type GeneratorTaskArtifact { Type string `json:"type"` Content string `json:"content"` Metadata GeneratorTaskArtifactMetadata `json:"metadata"` } type GeneratorTaskData { GeneratorTaskId string `json:"generator_task_id"` GeneratorName string `json:"generator_name"` Status string `json:"status"` OriginalInputArgs GeneratorTaskInputArgs `json:"original_input_args"` QueueInfo *GeneratorTaskQueueInfo `json:"queue_info,omitempty,optional"` Artifacts []GeneratorTaskArtifact `json:"artifacts,omitempty,optional"` } type GeneratorTaskResponse { Code int64 `json:"code"` Message string `json:"message"` Data GeneratorTaskData `json:"data"` } type GenerateResponse { Project Project `json:"project"` Message AgentMessage `json:"message"` GeneratedNodes []CanvasNode `json:"generatedNodes"` } type NodeActionRequest { Id string `path:"id"` NodeId string `path:"nodeId"` Action string `json:"action"` Prompt string `json:"prompt,optional"` ImageModel string `json:"imageModel,optional"` ImageSize string `json:"imageSize,optional"` Mask string `json:"mask,optional"` Selection string `json:"selection,optional"` Options map[string]string `json:"options,optional"` } type PrepareMockupSurfaceRequest { Id string `path:"id"` NodeId string `path:"nodeId"` } type MockupSurfaceResponse { Placement MockupPlacement `json:"placement"` Surface MockupSurface `json:"surface"` } type GenerateMockupModelRequest { Id string `path:"id"` NodeId string `path:"nodeId"` } type MockupModelResponse { Code int64 `json:"code"` Data MockupModel `json:"data"` Msg string `json:"msg"` } type MockupBlobRequest { DataId string `path:"dataId"` } type ExtractedTextLayer { Text string `json:"text"` OriginalText string `json:"originalText,optional"` X float64 `json:"x"` Y float64 `json:"y"` Width float64 `json:"width"` Height float64 `json:"height"` FontSize float64 `json:"fontSize,optional"` FontFamily string `json:"fontFamily,optional"` FontWeight string `json:"fontWeight,optional"` Color string `json:"color,optional"` TextAlign string `json:"textAlign,optional"` LineHeight float64 `json:"lineHeight,optional"` LetterSpacing float64 `json:"letterSpacing,optional"` StrokeColor string `json:"strokeColor,optional"` StrokeWidth float64 `json:"strokeWidth,optional"` Opacity float64 `json:"opacity,optional"` Rotation float64 `json:"rotation,optional"` Confidence float64 `json:"confidence,optional"` } type ExtractNodeTextRequest { Id string `path:"id"` NodeId string `path:"nodeId"` Prompt string `json:"prompt,optional"` } type ExtractNodeTextAsyncRequest { Id string `path:"id"` NodeId string `path:"nodeId"` Eitdortxt string `form:"eitdortxt,optional"` Feature string `form:"feature,optional"` } type ExtractNodeTextResponse { Items []ExtractedTextLayer `json:"items"` } type MergeLayersRequest { Id string `path:"id"` NodeIds []string `json:"nodeIds"` Title string `json:"title,optional"` } type SaveCanvasRequest { Id string `path:"id"` Version string `json:"version,optional"` SnapshotId string `json:"snapshotId,optional"` Canvas string `json:"canvas,optional"` Viewport CanvasViewport `json:"viewport"` Nodes []CanvasNode `json:"nodes"` Connections []CanvasConnection `json:"connections"` } type CreateAssetUploadRequest { FileName string `json:"fileName"` ContentType string `json:"contentType"` Size int64 `json:"size,optional"` } type CreateAssetUploadResponse { Driver string `json:"driver"` Bucket string `json:"bucket"` ObjectKey string `json:"objectKey"` UploadUrl string `json:"uploadUrl"` PublicUrl string `json:"publicUrl"` Headers map[string]string `json:"headers"` ExpiresIn int64 `json:"expiresIn"` } type DeleteAssetRequest { PublicUrl string `json:"publicUrl"` } type DeleteAssetResponse { Deleted bool `json:"deleted"` } @server ( prefix: /api ) service img_infinite_canvas-api { @handler health get /health returns (HealthResponse) @handler dashboard get /dashboard returns (DashboardResponse) @handler getAuthOptions get /auth/options returns (AuthOptionsResponse) @handler requestChinaSmsCode post /auth/china/sms-code (AuthCodeRequest) returns (AuthCodeResponse) @handler loginChinaSmsCode post /auth/china/sms-login (ChinaSmsLoginRequest) returns (AuthSessionResponse) @handler loginChinaPassword post /auth/china/password-login (ChinaPasswordLoginRequest) returns (AuthSessionResponse) @handler getWechatAuthUrl post /auth/china/wechat/auth-url returns (WechatAuthURLResponse) @handler loginChinaWechat post /auth/china/wechat-login (ChinaWechatLoginRequest) returns (AuthSessionResponse) @handler requestGlobalEmailCode post /auth/global/email-code (AuthCodeRequest) returns (AuthCodeResponse) @handler loginGlobalEmailCode post /auth/global/email-login (GlobalEmailLoginRequest) returns (AuthSessionResponse) @handler loginGlobalGoogle post /auth/global/google-login (GoogleLoginRequest) returns (AuthSessionResponse) @handler getAccountProfile get /account/profile returns (AccountProfileResponse) @handler updateAccountProfile patch /account/profile (UpdateAccountProfileRequest) returns (AccountProfileResponse) @handler listAccountDevices get /account/devices returns (AccountDeviceListResponse) @handler removeAccountDevices delete /account/devices returns (AccountDeviceMutationResponse) @handler logoutAccount post /account/logout returns (AccountDeviceMutationResponse) @handler listProjects get /projects (ProjectListRequest) returns (ProjectListResponse) @handler createProject post /projects (CreateProjectRequest) returns (ProjectResponse) @handler createProjectAsync post /projects/async (CreateProjectRequest) returns (ProjectResponse) @handler deleteProjects delete /projects/batch-delete (DeleteProjectsRequest) returns (DeleteProjectsResponse) @handler updateProjectTitle patch /projects/:id/title (UpdateProjectTitleRequest) returns (ProjectResponse) @handler getProject get /projects/:id (ProjectIdRequest) returns (ProjectResponse) @handler deleteProject delete /projects/:id (ProjectIdRequest) returns (DeleteProjectResponse) @handler projectEvents get /projects/:id/events (ProjectIdRequest) @handler agentChat post /projects/:id/agent/chat (AgentChatRequest) returns (AgentThreadResponse) @handler stopAgentTask post /projects/:id/agent/stop (StopAgentTaskRequest) returns (ProjectResponse) @handler agentWebsocket get /projects/:id/agent/ws (ProjectIdRequest) @handler getAgentThreadStatus get /projects/:id/agent/status (ProjectIdRequest) returns (AgentThreadStatusResponse) @handler listAgentThreads get /projects/:id/agent/threads (ProjectIdRequest) returns (AgentThreadListResponse) @handler getGeneratorTask get /generator/tasks (GeneratorTaskRequest) returns (GeneratorTaskResponse) @handler submitGeneratorTask post /generator/tasks (GeneratorTaskSubmitRequest) returns (GeneratorTaskSubmitResponse) @handler recognizeObject post /context/vision/recognize_object (RecognizeObjectRequest) returns (RecognizeObjectResponse) @handler getProjectHistory get /projects/:id/history (ProjectIdRequest) returns (ChatHistoryResponse) @handler generateProject post /projects/:id/generate (GenerateRequest) returns (GenerateResponse) @handler generateProjectAsync post /projects/:id/generate/async (GenerateRequest) returns (ProjectResponse) @handler runNodeActionAsync post /projects/:id/nodes/:nodeId/actions/async (NodeActionRequest) returns (ProjectResponse) @handler prepareMockupSurface post /projects/:id/nodes/:nodeId/mockup-surface (PrepareMockupSurfaceRequest) returns (MockupSurfaceResponse) @handler generateMockupModel post /projects/:id/nodes/:nodeId/mockup-model (GenerateMockupModelRequest) returns (AgentThreadResponse) @handler getMockupBlob get /mockup/blob/:dataId (MockupBlobRequest) @handler extractNodeText post /projects/:id/nodes/:nodeId/text-extraction (ExtractNodeTextRequest) returns (ExtractNodeTextResponse) @handler extractNodeTextAsync post /projects/:id/nodes/:nodeId/text-extraction/async (ExtractNodeTextAsyncRequest) returns (AgentThreadResponse) @handler mergeLayers post /projects/:id/layers/merge (MergeLayersRequest) returns (ProjectResponse) @handler saveCanvas patch /projects/:id/canvas (SaveCanvasRequest) returns (ProjectResponse) @handler createAssetUpload post /assets/upload-url (CreateAssetUploadRequest) returns (CreateAssetUploadResponse) @handler deleteAsset delete /assets (DeleteAssetRequest) returns (DeleteAssetResponse) }