{ "openapi" : "3.0.1", "info" : { "title" : "CMS Source Code", "description" : "API for managing and retrieving source code files and metadata", "version" : "v3", "x-hubspot-product-tier-requirements" : { "marketing" : "FREE", "sales" : "FREE", "service" : "FREE", "cms" : "STARTER", "commerce" : "FREE", "crmHub" : "FREE", "dataHub" : "FREE" }, "x-hubspot-related-documentation" : [ { "name" : "Source Code Guide", "url" : "https://developers.hubspot.com/docs/guides/api/cms/source-code" } ] }, "servers" : [ { "url" : "https://api.hubapi.com" } ], "tags" : [ { "name" : "Advanced" }, { "name" : "Basic" } ], "paths" : { "/cms/v3/source-code/extract/async" : { "post" : { "tags" : [ "Advanced" ], "summary" : "Extract a zip file", "description" : "Extract a zip file in the developer file system. Extraction status can be checked with the `/extract/async/tasks/taskId/status` endpoint below.", "operationId" : "post-/cms/v3/source-code/extract/async_doAsync", "parameters" : [ ], "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/FileExtractRequest" }, "example" : null } }, "required" : true }, "responses" : { "202" : { "description" : "accepted", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/TaskLocator" }, "example" : null } } }, "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-read", "source-code-write" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-read", "source-code-write" ] }, { "oauth2" : [ "source-code-read", "source-code-write" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ANY" } }, "/cms/v3/source-code/extract/async/tasks/{taskId}/status" : { "get" : { "tags" : [ "Advanced" ], "summary" : "Get extraction status", "description" : "Get the status of an extraction by the `taskId` returned from the initial `extract/async` request.", "operationId" : "get-/cms/v3/source-code/extract/async/tasks/{taskId}/status_getAsyncStatus", "parameters" : [ { "name" : "taskId", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "integer", "format" : "int32", "example" : null } } ], "responses" : { "200" : { "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ActionResponse" }, "example" : null } } }, "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-read", "source-code-write" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-read", "source-code-write" ] }, { "oauth2" : [ "source-code-read", "source-code-write" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ANY" } }, "/cms/v3/source-code/{environment}/content/{path}" : { "get" : { "tags" : [ "Basic" ], "summary" : "Download a file", "description" : "Downloads the byte contents of the file at the specified path in the specified environment.", "operationId" : "get-/cms/v3/source-code/{environment}/content/{path}_download", "parameters" : [ { "name" : "environment", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } } ], "responses" : { "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-read" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-read" ] }, { "oauth2" : [ "source-code-read" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ALL", "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] }, "put" : { "tags" : [ "Advanced" ], "summary" : "Create or update a file", "description" : "Upserts a file at the specified path in the specified environment. Accepts multipart/form-data content type.", "operationId" : "put-/cms/v3/source-code/{environment}/content/{path}_createOrUpdate", "parameters" : [ { "name" : "environment", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } } ], "requestBody" : { "content" : { "multipart/form-data" : { "schema" : { "type" : "object", "properties" : { "file" : { "type" : "string", "format" : "binary", "example" : null } }, "example" : null }, "example" : null } } }, "responses" : { "200" : { "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/AssetFileMetadata" }, "example" : null } } }, "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-write" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-write" ] }, { "oauth2" : [ "source-code-write" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ALL", "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] }, "post" : { "tags" : [ "Advanced" ], "summary" : "Create a file", "description" : "Creates a file at the specified path in the specified environment. Accepts multipart/form-data content type. Throws an error if a file already exists at the specified path.", "operationId" : "post-/cms/v3/source-code/{environment}/content/{path}_create", "parameters" : [ { "name" : "environment", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } } ], "requestBody" : { "content" : { "multipart/form-data" : { "schema" : { "type" : "object", "properties" : { "file" : { "type" : "string", "format" : "binary", "example" : null } }, "example" : null }, "example" : null } } }, "responses" : { "200" : { "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/AssetFileMetadata" }, "example" : null } } }, "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "deprecated" : true, "security" : [ { "app_cookie" : [ "source-code-write" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-write" ] }, { "oauth2" : [ "source-code-write" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ALL", "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] }, "delete" : { "tags" : [ "Basic" ], "summary" : "Delete a file", "description" : "Deletes the file at the specified path in the specified environment.", "operationId" : "delete-/cms/v3/source-code/{environment}/content/{path}_archive", "parameters" : [ { "name" : "environment", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } } ], "responses" : { "204" : { "description" : "No content", "content" : { } }, "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-write" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-write" ] }, { "oauth2" : [ "source-code-write" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ALL", "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] } }, "/cms/v3/source-code/{environment}/metadata/{path}" : { "get" : { "tags" : [ "Basic" ], "summary" : "Get the metadata for a file", "description" : "Gets the metadata object for the file at the specified path in the specified environment.", "operationId" : "get-/cms/v3/source-code/{environment}/metadata/{path}_get", "parameters" : [ { "name" : "environment", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } }, { "name" : "properties", "in" : "query", "description" : "", "required" : false, "style" : "form", "explode" : true, "schema" : { "type" : "string", "example" : null } } ], "responses" : { "200" : { "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/AssetFileMetadata" }, "example" : null } } }, "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-read" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-read" ] }, { "oauth2" : [ "source-code-read" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ALL", "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] } }, "/cms/v3/source-code/{environment}/validate/{path}" : { "post" : { "tags" : [ "Advanced" ], "summary" : "Validate the contents of a file", "description" : "Validates the file contents passed to the endpoint given a specified path and environment. Accepts multipart/form-data content type.", "operationId" : "post-/cms/v3/source-code/{environment}/validate/{path}_doValidate", "parameters" : [ { "name" : "environment", "in" : "path", "required" : true, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } } ], "requestBody" : { "content" : { "multipart/form-data" : { "schema" : { "type" : "object", "properties" : { "file" : { "type" : "string", "format" : "binary", "example" : null } }, "example" : null }, "example" : null } } }, "responses" : { "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "app_cookie" : [ "source-code-read", "source-code-write" ] }, { "hapikey" : [ ] }, { "internal_cookie" : [ "source-code-read", "source-code-write" ] }, { "oauth2" : [ "source-code-read", "source-code-write" ] }, { "shhkey" : [ ] } ], "x-hubspot-auth-scoping-type" : "ANY", "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] } } }, "components" : { "schemas" : { "ErrorDetail" : { "required" : [ "message" ], "type" : "object", "properties" : { "code" : { "type" : "string", "description" : "The status code associated with the error detail", "example" : null }, "context" : { "type" : "object", "additionalProperties" : { "type" : "array", "example" : null, "items" : { "type" : "string", "example" : null } }, "description" : "Context about the error condition", "example" : "{missingScopes=[scope1, scope2]}" }, "in" : { "type" : "string", "description" : "The name of the field or parameter in which the error was found.", "example" : null }, "message" : { "type" : "string", "description" : "A human readable message describing the error along with remediation steps where appropriate", "example" : null }, "subCategory" : { "type" : "string", "description" : "A specific category that contains more specific detail about the error", "example" : null } }, "example" : null }, "AssetFileMetadata" : { "required" : [ "createdAt", "folder", "id", "name", "updatedAt" ], "type" : "object", "properties" : { "archivedAt" : { "type" : "integer", "description" : "Timestamp of when the object was archived (deleted).", "format" : "int64", "example" : null }, "children" : { "type" : "array", "description" : "If the object is a folder, contains the filenames of the files within the folder.", "example" : null, "items" : { "type" : "string", "example" : null } }, "createdAt" : { "type" : "integer", "description" : "Timestamp of when the object was first created.", "format" : "int64", "example" : null }, "folder" : { "type" : "boolean", "description" : "Determines whether or not this path points to a folder.", "example" : null }, "hash" : { "type" : "string", "description" : "A unique identifier for the file's content, used to verify data integrity.", "example" : null }, "id" : { "type" : "string", "description" : "The path of the file in the CMS Developer File System.", "example" : null }, "name" : { "type" : "string", "description" : "The name of the file.", "example" : null }, "updatedAt" : { "type" : "integer", "description" : "Timestamp of when the object was last updated.", "format" : "int64", "example" : null } }, "example" : null }, "FileExtractRequest" : { "required" : [ "path" ], "type" : "object", "properties" : { "path" : { "type" : "string", "description" : "The file system location where the zip file is to be extracted.", "example" : null } }, "example" : null }, "Error" : { "required" : [ "category", "correlationId", "message" ], "type" : "object", "properties" : { "category" : { "type" : "string", "description" : "The error category", "example" : null }, "context" : { "type" : "object", "additionalProperties" : { "type" : "array", "example" : null, "items" : { "type" : "string", "example" : null } }, "description" : "Context about the error condition", "example" : "{invalidPropertyName=[propertyValue], missingScopes=[scope1, scope2]}" }, "correlationId" : { "type" : "string", "description" : "A unique identifier for the request. Include this value with any error reports or support tickets", "format" : "uuid", "example" : "aeb5f871-7f07-4993-9211-075dc63e7cbf" }, "errors" : { "type" : "array", "description" : "further information about the error", "example" : null, "items" : { "$ref" : "#/components/schemas/ErrorDetail" } }, "links" : { "type" : "object", "additionalProperties" : { "type" : "string", "example" : null }, "description" : "A map of link names to associated URIs containing documentation about the error or recommended remediation steps", "example" : null }, "message" : { "type" : "string", "description" : "A human readable message describing the error along with remediation steps where appropriate", "example" : "An error occurred" }, "subCategory" : { "type" : "string", "description" : "A specific category that contains more specific detail about the error", "example" : null } }, "example" : { "message" : "Invalid input (details will vary based on the error)", "correlationId" : "aeb5f871-7f07-4993-9211-075dc63e7cbf", "category" : "VALIDATION_ERROR", "links" : { "knowledge-base" : "https://www.hubspot.com/products/service/knowledge-base" } } }, "ActionResponse" : { "required" : [ "completedAt", "startedAt", "status" ], "type" : "object", "properties" : { "completedAt" : { "type" : "string", "description" : "The timestamp indicating when the action was completed.", "format" : "date-time", "example" : null }, "links" : { "type" : "object", "additionalProperties" : { "type" : "string", "example" : null }, "description" : "A map of link names to associated URIs containing documentation about the error or recommended remediation steps", "example" : null }, "requestedAt" : { "type" : "string", "description" : "The timestamp indicating when the action was requested.", "format" : "date-time", "example" : null }, "startedAt" : { "type" : "string", "description" : "The timestamp indicating when the action was started.", "format" : "date-time", "example" : null }, "status" : { "type" : "string", "description" : "The current status of the action, with possible values: CANCELED, COMPLETE, PENDING, PROCESSING.", "example" : null, "enum" : [ "CANCELED", "COMPLETE", "PENDING", "PROCESSING" ] } }, "example" : null }, "TaskLocator" : { "required" : [ "id" ], "type" : "object", "properties" : { "id" : { "type" : "string", "description" : "The unique identifier for the task.", "example" : null }, "links" : { "type" : "object", "additionalProperties" : { "type" : "string", "example" : null }, "description" : "A map of link names to associated URIs containing documentation about the error or recommended remediation steps", "example" : null } }, "example" : null } }, "responses" : { "Error" : { "description" : "An error occurred.", "content" : { "*/*" : { "schema" : { "$ref" : "#/components/schemas/Error" }, "example" : null } } } }, "securitySchemes" : { "developer_hapikey" : { "type" : "apiKey", "name" : "hapikey", "in" : "query" }, "hapikey" : { "type" : "apiKey", "name" : "hapikey", "in" : "query" }, "oauth2" : { "type" : "oauth2", "flows" : { "authorizationCode" : { "authorizationUrl" : "https://app.hubspot.com/oauth/authorize", "tokenUrl" : "https://api.hubapi.com/oauth/v1/token", "scopes" : { "developers-read" : "", "developers-write" : "", "portal-developers-access" : "" } } } }, "private_apps" : { "type" : "apiKey", "name" : "private-app", "in" : "header" }, "private_apps_legacy" : { "type" : "apiKey", "name" : "private-app-legacy", "in" : "header" } } }, "x-hubspot-available-client-libraries" : [ "Node", "Python", "Ruby", "PHP" ], "x-hubspot-product-tier-requirements" : { "marketing" : "FREE", "sales" : "FREE", "service" : "FREE", "cms" : "STARTER", "commerce" : "FREE", "crmHub" : "FREE", "dataHub" : "FREE" } }