vexConvexApi
constvexConvexApi:object
Defined in: packages/core/src/api/convex.ts:265
Typed anyApi references to the VexCMS generic Convex collection functions.
These point to functions that users copy into convex/vex/collections.ts
in their project. All paths are fixed under vex.collections.*.
Required: copy convex/vex/collections.ts from the VexCMS template
into your project before these references will resolve at runtime.
Used internally by view components in @vexcms/react. Framework adapter
authors do not need to import this directly unless building custom views.
Type Declaration
Section titled “Type Declaration”create
Section titled “create”
readonlycreate:FunctionReference<"mutation","public",VexCreateArgs,string>
Creates a new document. Returns the new document’s ID as a string.
readonlyfind:FunctionReference<"query","public",VexFindArgs,VexDocument[] |PaginationResult<VexDocument>>
Finds documents in a collection.
Called by react/src!CollectionListView in @vexcms/react.
findPaginated
Section titled “findPaginated”
readonlyfindPaginated:FunctionReference<"query","public",VexFindPaginatedArgs,PaginationResult<VexDocument>>
Finds documents in a collection with cursor pagination.
Called by react/src!CollectionListView in @vexcms/react.
readonlyget:FunctionReference<"query","public",VexGetArgs,VexDocument|null>
Fetches a single document by ID.
Called by react/src!CollectionEditView in @vexcms/react when editing.
globals
Section titled “globals”
readonlyglobals:object
globals.find
Section titled “globals.find”
readonlyfind:FunctionReference<"query","public",VexGlobalsFindArgs,VexDocumentGlobal<string>[]>
globals.get
Section titled “globals.get”
readonlyget:FunctionReference<"query","public",VexGlobalsGetArgs,VexDocumentGlobal<string> |null>
globals.upsert
Section titled “globals.upsert”
readonlyupsert:FunctionReference<"mutation","public",VexGlobalsUpdateArgs,string>
readonlymedia:object
media.createMediaDocument
Section titled “media.createMediaDocument”
readonlycreateMediaDocument:FunctionReference<"mutation","public",VexMediaCreateMediaDocumentArgs,string>
Creates a media document in Convex after the file is uploaded.
Called by MediaUploadDropzone in @vexcms/react.
media.deleteMedia
Section titled “media.deleteMedia”
readonlydeleteMedia:FunctionReference<"mutation","public",VexMediaDeleteMediaArgs,boolean>
Deletes a media document and its file from storage.
Called by MediaLibrary in @vexcms/react.
media.generateUploadUrl
Section titled “media.generateUploadUrl”
readonlygenerateUploadUrl:FunctionReference<"mutation","public",VexMediaGenerateUploadUrlArgs,VexMediaGenerateUploadUrlReturn>
Generates a URL to upload a file to.
Called by MediaUploadDropzone in @vexcms/react.
media.getUrl
Section titled “media.getUrl”
readonlygetUrl:FunctionReference<"query","public",VexMediaGetUrlArgs,VexMediaGetUrlReturn>
Returns a URL for a media file.
Called by UploadFieldCell in @vexcms/react.
remove
Section titled “remove”
readonlyremove:FunctionReference<"mutation","public",VexRemoveArgs,void>
Permanently deletes a document.
search
Section titled “search”
readonlysearch:FunctionReference<"query","public",VexSearchArgs,VexDocument[] |PaginationResult<VexDocument>>
Searches documents in a collection by a search index.
Used by RelationshipFieldInput in @vexcms/react to populate the
relationship picker combobox. The searchIndexName must match the
.searchIndex() name in the Convex schema — VexCMS auto-generates
search_<useAsTitle> when another collection has a relationship here.
Pass query: "" to list recent documents when no search term is entered.
https://docs.convex.dev/text-search for Convex search docs
update
Section titled “update”
readonlyupdate:FunctionReference<"mutation","public",VexUpdateArgs,void>
Patches an existing document — unspecified fields are left unchanged.
Example
Section titled “Example”import { convexQuery } from "@convex-dev/react-query";import { useQuery } from "@tanstack/react-query";import { vexConvexApi } from "@vexcms/core";
const { data } = useQuery({ ...convexQuery(vexConvexApi.list, { collection: "posts" }),});