{ "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" : [ { "oauth2" : [ "content" ] } ] } }, "/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" : [ { "oauth2" : [ "content" ] } ] } }, "/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" : "The environment of the file (\"draft\" or \"published\").", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string", "example" : null } }, { "name" : "path", "in" : "path", "description" : "The file system location of the file.", "required" : true, "style" : "simple", "explode" : false, "schema" : { "pattern" : ".+", "type" : "string", "example" : null } } ], "responses" : { "default" : { "description" : "", "$ref" : "#/components/responses/Error" } }, "security" : [ { "oauth2" : [ "content" ] } ], "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" : [ { "oauth2" : [ "content" ] } ], "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" : [ { "oauth2" : [ "content" ] } ], "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" : [ { "oauth2" : [ "content" ] } ], "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" : [ { "oauth2" : [ "content" ] } ], "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" : [ { "oauth2" : [ "content" ] } ], "x-hubspot-rate-limit-exemptions" : [ "ten-secondly" ] } } }, "components" : { "schemas" : { "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 }, "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 }, "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 } }, "description" : "Represents an error response returned by the API when an operation fails. This component is used in various endpoints to provide detailed information about the error encountered.", "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" } } }, "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 } }, "description" : "Represents detailed information about an error that occurred in the API. This component is used to provide additional context and specifics about errors, typically as part of an error response.", "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 }, "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" }, "oauth2" : { "type" : "oauth2", "flows" : { "authorizationCode" : { "authorizationUrl" : "https://app.hubspot.com/oauth/authorize", "tokenUrl" : "https://api.hubapi.com/oauth/v1/token", "scopes" : { "content" : "" } } } }, "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" } }