{"openapi":"3.1.0","info":{"title":"Gradient Core BaaS API","version":"1.0.0","description":"Domain-agnostic multimodal ETL, Gemini Decision 1, embedding, and Gale-Shapley entity matching BaaS API."},"servers":[{"url":"https://api.gradient.pbt.mn/v1"}],"x-google-backend":{"address":"https://api.gradient.pbt.mn/v1","protocol":"h2","path_translation":"APPEND_PATH_TO_ADDRESS"},"security":[{"BearerAuth":[]},{"TenantKeyAuth":[]}],"paths":{"/health":{"get":{"summary":"Core BaaS service health check","security":[],"responses":{"200":{"description":"Service healthy"}}}},"/openapi.json":{"get":{"summary":"Retrieve authoritative OpenAPI 3.1.0 specification","security":[],"responses":{"200":{"description":"OpenAPI 3.1.0 JSON document"}}}},"/classes":{"get":{"summary":"List tenant Entity Classes","responses":{"200":{"description":"Entity Class definitions"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Register or update an Entity Class definition","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityClassInput"}}}},"responses":{"201":{"description":"Entity Class persisted"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/entities":{"get":{"summary":"List tenant Entities","parameters":[{"name":"classId","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant entities"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create or update an Entity with automatic attribute synthesis","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityUpsertInput"}}}},"responses":{"201":{"description":"Entity saved"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/entities/{entityId}":{"get":{"summary":"Get a tenant Entity by ID","parameters":[{"name":"entityId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Entity details"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"summary":"Delete a tenant Entity from active tier while retaining cold archive","parameters":[{"name":"entityId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Entity deleted from active tier"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/uploads":{"post":{"summary":"Create a short-lived signed upload URL for an artifact payload","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedUploadInput"}}}},"responses":{"201":{"description":"Signed upload descriptor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedUploadDescriptor"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/uploads/{uploadToken}":{"put":{"summary":"Upload raw artifact bytes (text or binary) to a signed upload URL","security":[],"parameters":[{"name":"uploadToken","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Object stored"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/entities/{entityId}/artifacts":{"get":{"summary":"List active Artifacts belonging to an Entity","parameters":[{"name":"entityId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Entity artifacts"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Ingest an Artifact by object reference through the two-layer ETL pipeline","parameters":[{"name":"entityId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactIngestInput"}}}},"responses":{"201":{"description":"Artifact ingested"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/entities/{entityId}/artifacts/{artifactId}":{"patch":{"summary":"Incrementally update a single Artifact by object reference and recompute centroids","parameters":[{"name":"entityId","in":"path","required":true,"schema":{"type":"string"}},{"name":"artifactId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactIngestInput"}}}},"responses":{"200":{"description":"Artifact updated"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"summary":"Delete an Artifact from active tier while retaining cold archive","parameters":[{"name":"entityId","in":"path","required":true,"schema":{"type":"string"}},{"name":"artifactId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Artifact deleted from active tier"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/decisions:evaluate":{"post":{"summary":"Evaluate 1..1000 noul/choice/rubric questions via gemini-decision-1","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionEvaluateInput"}}}},"responses":{"200":{"description":"Calibrated decision results"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/matches:run":{"post":{"summary":"Execute bipartite Gale-Shapley, unipartite cohort, top-K, or pairwise overlap","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRunInput"}}}},"responses":{"200":{"description":"Matching run result"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/usage":{"get":{"summary":"Retrieve tenant daily metered usage, segmented billing, and remaining quota","responses":{"200":{"description":"Usage summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageSummary"}}}}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Tenant API Key"},"TenantKeyAuth":{"type":"apiKey","in":"header","name":"X-Tenant-Api-Key"}},"schemas":{"SignedUploadInput":{"type":"object","required":["modality","mimeType","sizeBytes","contentHash"],"properties":{"artifactId":{"type":"string"},"entityId":{"type":"string"},"modality":{"type":"string","enum":["text","image","audio","video","pdf"]},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":1},"contentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}},"SignedUploadDescriptor":{"type":"object","properties":{"uploadId":{"type":"string"},"uploadToken":{"type":"string"},"tenantId":{"type":"string"},"objectPath":{"type":"string"},"uploadUrl":{"type":"string"},"method":{"type":"string","const":"PUT"},"modality":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer"},"contentHash":{"type":"string"},"expiresAt":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}}}},"ByoModelCredential":{"type":"object","properties":{"apiKey":{"type":"string"},"accessToken":{"type":"string"},"projectId":{"type":"string"},"location":{"type":"string"}}},"EntityClassInput":{"type":"object","required":["classId","label"],"properties":{"classId":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"defaultRole":{"type":"string","enum":["proposer","reviewer","both"]},"allowPassive":{"type":"boolean"},"decisionQuestions":{"type":"object","additionalProperties":true},"dimensions":{"type":"array","items":{"type":"object"}},"lenses":{"type":"array","items":{"type":"object"}}}},"EntityUpsertInput":{"type":"object","required":["entityId","classId","displayName"],"properties":{"entityId":{"type":"string"},"classId":{"type":"string"},"displayName":{"type":"string"},"role":{"type":"string","enum":["proposer","reviewer","both"]},"capacity":{"type":"integer","minimum":1},"attributes":{"type":"object","additionalProperties":true}}},"ArtifactIngestInput":{"type":"object","required":["modality","objectPath","contentHash"],"properties":{"id":{"type":"string"},"polarity":{"type":"string","enum":["offering","preference"]},"dimensionKey":{"type":"string"},"modality":{"type":"string","enum":["text","image","audio","video","pdf"]},"mimeType":{"type":"string"},"objectPath":{"type":"string"},"contentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"visibility":{"type":"string","enum":["public","private"]},"questions":{"type":"object","additionalProperties":true},"byoCredential":{"$ref":"#/components/schemas/ByoModelCredential"}}},"DecisionEvaluateInput":{"type":"object","required":["objectPath","contentHash","questions"],"properties":{"modality":{"type":"string","enum":["text","image","audio","video","pdf"]},"mimeType":{"type":"string"},"objectPath":{"type":"string"},"contentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"questions":{"type":"object","additionalProperties":true},"byoCredential":{"$ref":"#/components/schemas/ByoModelCredential"}}},"MatchRunInput":{"type":"object","required":["operation","lensId"],"properties":{"operation":{"type":"string","enum":["bipartite_gale_shapley","unipartite_cohort","top_k_similarity","pairwise_overlap"]},"lensId":{"type":"string"},"proposerClassId":{"type":"string"},"reviewerClassId":{"type":"string"},"targetEntityId":{"type":"string"},"counterpartEntityId":{"type":"string"},"candidateEntityIds":{"type":"array","items":{"type":"string"}},"topK":{"type":"integer","minimum":1}}},"UsageSummary":{"type":"object","properties":{"tenantId":{"type":"string"},"totalUnits":{"type":"integer"},"dailyQuotaLimit":{"type":"integer"},"remainingQuota":{"type":"integer"},"byOperation":{"type":"object"},"segmentedBilling":{"type":"object"}}},"ErrorResponse":{"type":"object","required":["ok","error"],"properties":{"ok":{"type":"boolean","const":false},"error":{"type":"string"}}}}}}