Create ({collection.name})

Create a new {collection.name} record.

Body parameters could be sent as application/json or multipart/form-data.

File upload is supported only via multipart/form-data.
For more info and examples you could check the detailed Files upload and handling docs .

${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection)), null, 2)}; final record = await pb.collection('${collection?.name}').create(body: body); ` + (collection?.isAuth ? ` // (optional) send an email verification request await pb.collection('${collection?.name}').requestVerification('test@example.com'); ` : "" )} />
API details
POST

/api/collections/{collection.name}/records

{#if adminsOnly}

Requires admin Authorization:TOKEN header

{/if}
Body Parameters
{#if collection?.isAuth} {/if} {#each collection?.schema as field (field.name)} {/each}
Param Type Description
Optional id
String 15 characters string to store as record ID.
If not set, it will be auto generated.
Auth fields
Optional username
String The username of the auth record.
If not set, it will be auto generated.
{#if collection?.options?.requireEmail} Required {:else} Optional {/if} email
String Auth record email address.
Optional emailVisibility
Boolean Whether to show/hide the auth record email when fetching the record data.
Required password
String Auth record password.
Required passwordConfirm
String Auth record password confirmation.
Optional verified
Boolean Indicates whether the auth record is verified or not.
This field can be set only by admins or auth records with "Manage" access.
Schema fields
{#if field.required} Required {:else} Optional {/if} {field.name}
{CommonHelper.getFieldValueType(field)} {#if field.type === "text"} Plain text value. {:else if field.type === "number"} Number value. {:else if field.type === "json"} JSON array or object. {:else if field.type === "email"} Email address. {:else if field.type === "url"} URL address. {:else if field.type === "file"} File object.
Set to null to delete already uploaded file(s). {:else if field.type === "relation"} Relation record {field.options?.maxSelect === 1 ? "id" : "ids"}. {/if}
Query parameters
Param Type Description
expand String Auto expand relations when returning the created record. Ex.: Supports up to 6-levels depth nested relations expansion.
The expanded relations will be appended to the record under the expand property (eg. {`"expand": {"relField1": {...}, ...}`}).
Only the relations to which the request user has permissions to view will be expanded.
Responses
{#each responses as response (response.code)} {/each}
{#each responses as response (response.code)}
{/each}