---
title: "POST /scripts/save"
method: POST
path: "/scripts/save"
tags: ["scripts"]
---

# POST /scripts/save

`POST /scripts/save`

Updates or creates a new script. If an id is provided, the corresponding script will be updated. Otherwise, a new script will be created.

## Headers

- `X-Phantombuster-Org` string

## Request body

- object
  - `id` string — If set, the script with the corresponding id will be updated.
  - `name` string — Name of the script. Prepend your name with "lib-" to define your script as a module.
  - `branch` string, nullable — Name of the branch to associate with the script.
  - `code` string, nullable — Javascript source code of the script.
  - `markdown` string, nullable — Markdown description of the script.
  - `manifest` object, nullable — JSON script manifest.
    - `slug` string, required
    - `description` string, required
    - `kind` 'lib', required
    - `documentation` object, required
      - `summary` string, required
      - `exports` object[], required
        - `name` string, required
        - `kind` 'function' | 'class' | 'interface' | 'typeAlias' | 'enum' | 'const' | 'namespace', required
        - `signature` string, required
    - `unlisted` boolean
    - `isDeprecated` boolean
    - `isBaasCompatible` boolean
    - `personalUseOnly` boolean
    - `featuredRank` number
    - `usageRank` number
    - `categories` string[]
    - `tags` object
      - `categories` string[]
      - `extractions` string[]
      - `actions` string[]
      - `goals` string[]
    - `defaultArgument` object
    - `outputDescription` object
    - `defaultArgumentAllowed` boolean
    - `argumentForm` object
      - `enabled` boolean
      - `steps` object[]
        - `slug` string, required
        - `title` string, required
        - `headerTitle` string
        - `fields` object, required
        - `helper` string
        - `helpers` union
          - string[]
          - string
    - `argumentSchema` object
      - `type` 'object'
      - `properties` object
    - `argumentTypes` object
    - `outputTypes` object
    - `updated` boolean
    - `update` boolean
    - `defaultSettings` object
      - `executionTimeLimit` number, nullable
      - `fileMgmt` 'folders' | 'mix' | 'delete'
      - `fileMgmtMaxFolders` number, nullable
      - `maxParallelism` number, nullable
      - `maxRetryNumber` number, nullable
      - `launchType` 'manually' | 'repeatedly'
      - `repeatedLaunchPreset` 'Once every other day' | 'Once per day' | 'Once per day, at the start of the day' | 'Twice per day' | 'Thrice per day' | '4 times per day' | '6 times per day' | '8 times per day' | 'Once every other hour' | 'Once per hour' | 'Twice per hour' | 'Thrice per hour' | '4 times per hour' | 'Once every other working hour' | 'Once per working hour' | 'Twice per working hour' | 'Thrice per working hour' | '4 times per working hour' | 'Once every other working hour, excluding weekends' | 'Once per working hour, excluding weekends' | 'Twice per working hour, excluding weekends' | 'Thrice per working hour, excluding weekends' | '4 times per working hour, excluding weekends'
      - `notificationPreset` 'none' | 'error' | 'success'
      - `ignoreNotificationPresetForOrgSlugs` string[], nullable
      - `notifications` object, nullable — Sets the default notification settings of the agent.
        - `mailAutomaticExitSuccess` boolean
        - `mailAutomaticExitError` boolean
        - `mailAutomaticLaunchError` boolean
        - `mailAutomaticTimeError` boolean
        - `mailManualExitSuccess` boolean
        - `mailManualExitError` boolean
        - `mailManualLaunchError` boolean
        - `mailManualTimeError` boolean
        - `slackWebHook` string
        - `slackAutomaticExitSuccess` boolean
        - `slackAutomaticExitError` boolean
        - `slackAutomaticLaunchError` boolean
        - `slackAutomaticTimeError` boolean
        - `slackManualExitSuccess` boolean
        - `slackManualExitError` boolean
        - `slackManualLaunchError` boolean
        - `slackManualTimeError` boolean
        - `webhook` string — Your custom webhook URL. We will post insightful information about your agent run at this address once it's done. You might be interested in our article on [how to use webhooks](https://hub.phantombuster.com/docs/using-webhooks)
      - `proxyLease` object
        - `groupSlug` string, nullable
        - `refreshRate` integer, required
      - `proxyType` 'none' | 'http' | 'pool' | 'squid lease'
    - `inputIcon` string
    - `outputIcon` string
    - `status` object
      - `type` string
      - `description` string
    - `askUserToNameAgent` boolean
    - `reservedAgentSlots` integer
    - `hideSetupLaunchSettings` boolean
    - `hideFolderManagement` boolean
    - `onlyListedForUsersEnrolledInBeta` boolean
    - `diffusionGroups` object[]
      - `arguments` string[], required
      - `title` string, required
    - `embeddedYouTubeVideo` object
      - `videoId` string, required — The YouTube video ID that identifies the video that the player will load.
      - `videoHeader` string — The text that is displayed above the video player. The length is restricted to 40 characters.
    - `tutorialArticleUrl` string
    - `plugins` union[]
      - union
        - object
          - `name` 'rateLimitsRecommendations', required
          - `recommendations` object, required
        - object
          - `name` 'chainedResultsManagement', required
          - `options` object, required
            - `chainedResultsFieldName` string, required
            - `columnTypesToDisplay` union[], required
              - …
            - `exclusionList` object
              - …
        - object
          - `name` 'attachments', required
          - `options` object, required
            - `associatedFieldName` string, required
            - `validationType` 'linkedinMessage', required
        - object
          - `name` 'setupMappedFieldsColumnLayoutDisplay', required
          - `options` object, required
            - `leftColumnTitle` string, required
            - `rightColumnTitle` string, required
            - `sectionFieldNameList` string[], required
            - `label` string
            - `helper` string
            - `displayPreviewQueries` boolean
        - object
          - `name` 'taggedTemplateInterpolation', required
          - `associatedFieldName` string, required
          - `sortedAvailableTags` union[], required
            - union
              - …
        - object
          - `name` 'leadDatabaseContribution', required
          - `lastVersionAt` number, required
        - object
          - `name` 'acceptsLeadListAsInput', required
          - `hideMyPhantomsMode` boolean
          - `hideCsvUrlMode` boolean
          - `skipFirstStepIfPrefilled` boolean
        - object
          - `name` 'dividedInputType', required
          - `associatedFieldName` string, required
          - `optionIcons` string[], required
        - object
          - `name` 'acceptsCRMListAsInput', required
          - `helperText` string
          - `hideMyPhantomsMode` boolean
          - `hideCsvUrlMode` boolean
        - object
          - `name` 'crmOutputMappingPlugin', required
          - `options` object, required
            - `activationArgumentName` string
            - `optionalFieldsArgumentName` string
            - `optionalFields` object[], required
              - …
            - `requiredFields` object[], required
              - …
        - object
          - `name` 'crmInputMappingPlugin', required
          - `options` object, required
            - `fieldName` string, required
            - `activationArgumentName` string
            - `requiredFields` object[], required
              - …
        - object
          - `name` 'useMultiIdentities', required
          - `multiIdentityFieldName` string, required
        - object
    - `noLogTimeout` number
    - `argumentsToSendToAnalytics` string[]
    - `recommenderMetadata` object — Configuration for the AI recommender (campaign_agent) system to provide better phantoms suggestions
      - `workers` string[]
      - `standalone` boolean
      - `description` string
    - `visibleInChat` string[]

## Response `200`

Script updated or inserted successfully.

- object
  - `id` string, required
  - `name` string, required

## Other responses

- `400` — Branch doesn't exist or script not found.
- `402` — Maximum amount of scripts reached. Please upgrade your plan to unlock more slots for your scripts.
- `409` — A script with the same name already exists.
- `412` — No difference with existing code, manifest and markdown.

---

[API](https://skmtc.net/phantombuster/apis/phantombuster-api-v2.md) · [All operations](https://skmtc.net/phantombuster/apis/phantombuster-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phantombuster/phantombuster-api-v2/versions/acf0049d7c7f/schema)
