fastify-xwhatconverts
accounts.create
Create a new WhatConverts account. Requires Agency Key.
accounts.create
Create a new WhatConverts account. Requires an Agency (Master) API Key. Optionally create a default profile at the same time.
Signature
fastify.xwhatconverts.accounts.create(params: {
accountName: string;
createProfile?: boolean;
}): Promise<object>
Params
| Name | Type | Required | Description |
|---|---|---|---|
accountName | string | Yes | Name for the new account. |
createProfile | boolean | No | Create a default profile for the account. Default false. |
Returns
The created WhatConverts account object.
Throws
[xWhatConverts] accounts.create: params object is required— called without a params object.[xWhatConverts] accounts.create: accountName is required— missingaccountName.[xWhatConverts] Network error: <message>— network-level failure.[xWhatConverts] API error: <status>— non-2xx response from WhatConverts.
Examples
Basic — create an account
const account = await fastify.xwhatconverts.accounts.create({
accountName: "Acme Corp",
});
console.log(account.account_id);
Realistic — provision a new client account with default profile
fastify.post("/clients", async (request, reply) => {
const { clientName } = request.body;
const account = await fastify.xwhatconverts.accounts.create({
accountName: clientName,
createProfile: true,
});
return reply.status(201).send({
accountId: account.account_id,
accountName: account.account_name,
});
});
See Also
- accounts.get — fetch the created account
- accounts.update — rename an account
- profiles.create — create a profile for this account
AI Context
package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.accounts.create(params)
use-when: Create a new WhatConverts account — requires Agency (Master) API key; optionally creates a default profile
params: accountName (string, required), createProfile (boolean, optional)
returns: WhatConverts account object
