Home
Content Management API⁡𝅶‍‍𝅺⁡‍𝅴⁡𝅴𝅹‍‍⁢𝅵‍‍⁣‌⁡⁣𝅺⁢𝅸⁡⁢‍𝅹⁢𝅺𝅸‍‍‍𝅷‍‍𝅳⁡‍⁠‍‍⁢𝅵‍‍𝅳⁡⁣⁡⁣⁡​⁡⁢⁢𝅵‍𝅺‍𝅺⁢𝅸⁡⁢‍𝅹⁣‌⁡⁣𝅺⁢𝅸⁡⁢‍𝅹⁢𝅺𝅸‍𝅺⁠⁣𝅴⁡⁣𝅺⁡‍‍𝅺𝅴⁡⁣⁠𝅸⁠𝅺⁡⁣⁡𝅴⁡​⁠⁡⁢‍𝅺⁢𝅳⁢‌⁢​⁢𝅴⁢‍⁢⁠‍𝅺𝅴⁡⁣⁠𝅸⁡⁢‍𝅺⁢⁢⁢𝅴⁢𝅳⁢⁢⁢‌⁢⁡⁢𝅳⁢‌‍‍⁡𝅸
Main resources
Upload-related
Site Search
Environments
UI
Workflows
Async jobs
Roles & permissions
Webhooks
Hosting & CI integrations
Subscription
Enterprise
    Show examples in:
    Create a new plugin

    Parameters

    package_name  null, string  Optional

    NPM package name of the public plugin you want to install. For public plugins, that's the only attribute you need to pass.

    name  string  Optional

    The name of the plugin. Only to be passed if package name key is not specified.

    description  null, string  Optional

    A description of the plugin. Only to be passed if package name key is not specified.

    url  string  Optional

    The entry point URL of the plugin. Only to be passed if package name key is not specified.

    permissions  Array<string>  Optional

    Permissions granted to this plugin. Only to be passed if package name key is not specified.

    Returns

    Returns a plugin resource object.

    Examples

    The following examples are available:

    Installation of a public plugin from NPM
    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const plugin = await client.plugins.create({
    package_name: 'datocms-plugin-star-rating-editor',
    });
    console.log(plugin);
    }
    run();
    Returned output:
    const result = {
    type: 'plugin',
    id: '124',
    name: '5 stars',
    description: 'A better rating experience!',
    package_name: 'datocms-plugin-star-rating-editor',
    package_version: '0.0.4',
    url: 'https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js',
    permissions: ['currentUserAccessToken'],
    parameters: {},
    };
    Creation of a private plugin
    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const plugin = await client.plugins.create({
    name: '5 stars',
    description: 'A better rating experience!',
    url: 'https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js',
    permissions: ['currentUserAccessToken'],
    });
    console.log(plugin);
    }
    run();
    Returned output:
    const result = {
    type: 'plugin',
    id: '124',
    name: '5 stars',
    description: 'A better rating experience!',
    url: 'https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js',
    permissions: ['currentUserAccessToken'],
    parameters: {},
    };