{ "openapi" : "3.0.1", "info" : { "title" : "Repository Templates for Bitbucket REST API", "description" : "REST API documentation for the app Repository Templates for Bitbucket.\n The REST API allows you to maintain the project settings of the\n app as well as the global repository templates.", "contact" : { "name" : "Mibex Software GmbH", "url" : "https://www.mibexsoftware.com" }, "license" : { "name" : "Copyright (c) 2025 by Mibex Software GmbH, Switzerland. All rights reserved.", "url" : "https://mibexsoftware.com/imprint/" }, "version" : "v1" }, "servers" : [ { "url" : "https://YOUR_BITBUCKET_SERVER//rest/templates4stash/1.0" } ], "paths" : { "/global-templates" : { "get" : { "tags" : [ "Global templates" ], "summary" : "Returns the defined global repository templates.", "operationId" : "getGlobalTemplates", "responses" : { "200" : { "description" : "Global repository templates found", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/GlobalTemplate" } } } } }, "401" : { "description" : "The currently authenticated user does not have ADMIN credentials" } } }, "put" : { "tags" : [ "Global templates" ], "summary" : "Updates a global repository template.", "operationId" : "updateGlobalTemplate", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/GlobalTemplate" } } }, "required" : true }, "responses" : { "200" : { "description" : "Global repository templates updated", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/GlobalTemplate" } } } }, "401" : { "description" : "The currently authenticated user does not have ADMIN credentials" }, "404" : { "description" : "The global template does not exist" } } }, "post" : { "tags" : [ "Global templates" ], "summary" : "Creates a global repository template.", "operationId" : "createGlobalTemplate", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/GlobalTemplate" } } }, "required" : true }, "responses" : { "200" : { "description" : "Global repository templates created", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/GlobalTemplate" } } } }, "400" : { "description" : "Invalid input parameters like a non-existing template" }, "401" : { "description" : "The currently authenticated user does not have ADMIN credentials" } } }, "delete" : { "tags" : [ "Global templates" ], "summary" : "Deletes a global repository template.", "operationId" : "deleteGlobalTemplate", "parameters" : [ { "name" : "id", "in" : "query", "description" : "ID of template that should be deleted", "required" : true, "schema" : { "type" : "integer", "format" : "int32" } } ], "responses" : { "200" : { "description" : "Global repository templates deleted" }, "401" : { "description" : "The currently authenticated user does not have ADMIN credentials" }, "404" : { "description" : "The global template does not exist" } } } }, "/projects/{projectKey}/project-templates" : { "get" : { "tags" : [ "Project templates" ], "summary" : "Returns the defined project-level repository templates.", "operationId" : "getProjectTemplates", "parameters" : [ { "name" : "projectKey", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "200" : { "description" : "Project-level repository templates found", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/ProjectTemplate" } } } } }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" } } }, "put" : { "tags" : [ "Project templates" ], "summary" : "Updates a project-level repository template.", "operationId" : "updateProjectTemplate", "parameters" : [ { "name" : "projectKey", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectTemplate" } } }, "required" : true }, "responses" : { "200" : { "description" : "Project-level repository templates updated", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectTemplate" } } } }, "400" : { "description" : "Invalid input parameters like a non-existing template" }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" } } }, "post" : { "tags" : [ "Project templates" ], "summary" : "Creates a project-level repository template.", "operationId" : "createProjectTemplate", "parameters" : [ { "name" : "projectKey", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectTemplate" } } }, "required" : true }, "responses" : { "200" : { "description" : "Project-level repository templates created", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectTemplate" } } } }, "400" : { "description" : "Invalid input parameters like a non-existing template" }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" } } }, "delete" : { "tags" : [ "Project templates" ], "summary" : "Deletes a project-level repository template.", "operationId" : "deleteProjectTemplate", "parameters" : [ { "name" : "projectKey", "in" : "path", "description" : "Project key where the template will be delete", "required" : true, "schema" : { "type" : "string" } }, { "name" : "id", "in" : "query", "description" : "ID of template that should be deleted", "schema" : { "type" : "integer", "format" : "int32" } } ], "responses" : { "200" : { "description" : "Project-level repository templates deleted" }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" }, "404" : { "description" : "The project template does not exist" } } } }, "/projects/{projectKey}/repo-template" : { "post" : { "tags" : [ "Create repository" ], "summary" : "Creates a repository from a template. Only available since app version 3.4.0.", "operationId" : "createRepoFromTemplate", "parameters" : [ { "name" : "projectKey", "in" : "path", "description" : "Project under which the new repository will be created", "required" : true, "schema" : { "type" : "string" } } ], "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/RepoCreateInfo" } } }, "required" : true }, "responses" : { "202" : { "description" : "Repository from template creation triggered" }, "400" : { "description" : "The given repository template or the new repository parameters are invalid" }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" }, "404" : { "description" : "The project does not exist" } } } }, "/projects/{projectKey}/settings" : { "get" : { "tags" : [ "Project settings" ], "summary" : "Returns the project settings of the plug-in.", "operationId" : "getProjectSettings", "parameters" : [ { "name" : "projectKey", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "200" : { "description" : "Project settings found", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectSettings" } } } }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" }, "404" : { "description" : "Project not found or no project settings" } } }, "put" : { "tags" : [ "Project settings" ], "summary" : "Updates the project settings of the plug-in.", "operationId" : "saveProjectSettings", "parameters" : [ { "name" : "projectKey", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectSettings" } } }, "required" : true }, "responses" : { "200" : { "description" : "Project settings updated", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProjectSettings" } } } }, "400" : { "description" : "Bad request: the provided project settings are invalid" }, "401" : { "description" : "The currently authenticated user does not have PROJECT_ADMIN credentials" }, "404" : { "description" : "Project not found or project settings do not exist" } } } } }, "components" : { "schemas" : { "GlobalTemplate" : { "type" : "object", "properties" : { "description" : { "type" : "string", "description" : "the description of the global template" }, "id" : { "type" : "integer", "description" : "the ID of the global template configuration", "format" : "int32" }, "logoData" : { "type" : "string", "description" : "the base64-encoded image logo" }, "template" : { "$ref" : "#/components/schemas/RestRepositoryRef" } } }, "ProjectRef" : { "type" : "object", "properties" : { "key" : { "type" : "string" } } }, "ProjectSettings" : { "type" : "object", "properties" : { "allowUsersToChooseTemplate" : { "type" : "boolean", "description" : "true if a user is allowed to choose another template than the default when creating a new repository" }, "cronExpression" : { "type" : "string", "description" : "the cron expression to use for resetting the settings of associated repositories to the one of the configured template (use null to deactivate the periodic reset)" }, "forkTemplateSyncEnabled" : { "type" : "boolean", "description" : "Sync settings from template to new repository forks" }, "gitMirrorType" : { "type" : "string", "description" : "Configure how the repository template content should be copied to the new repository.", "enum" : [ "MIRROR", "WITHOUTHISTORY" ] }, "repoMirrorEnabled" : { "type" : "boolean", "description" : "true if you want the content of a template being mirrored to a repository on its creation" }, "settingsToUse" : { "$ref" : "#/components/schemas/SettingsToUse" }, "templateFeatureEnabled" : { "type" : "boolean", "description" : "Enables/disables repository templates for project " } } }, "ProjectTemplate" : { "type" : "object", "properties" : { "defaultTemplate" : { "type" : "boolean", "description" : "is default template" }, "description" : { "type" : "string", "description" : "the description of the project-level template" }, "id" : { "type" : "integer", "description" : "the ID of the project-level template configuration", "format" : "int32" }, "logoData" : { "type" : "string", "description" : "the base64-encoded image logo" }, "repos" : { "type" : "array", "description" : "the list of repositories that should be assigned to this template; just pass a list of repository ID's, e.g., [ { \"id\" : 1 }, { \"id\" : 2 } ]. You should leave this empty for DELETE.", "items" : { "type" : "object", "additionalProperties" : { "type" : "object", "description" : "the list of repositories that should be assigned to this template; just pass a list of repository ID's, e.g., [ { \"id\" : 1 }, { \"id\" : 2 } ]. You should leave this empty for DELETE." }, "description" : "the list of repositories that should be assigned to this template; just pass a list of repository ID's, e.g., [ { \"id\" : 1 }, { \"id\" : 2 } ]. You should leave this empty for DELETE." } }, "template" : { "$ref" : "#/components/schemas/RestRepositoryRef" } } }, "RepoCreateInfo" : { "required" : [ "repoName", "template" ], "type" : "object", "properties" : { "repoName" : { "type" : "string", "description" : "the name of the to be created repository from the given template" }, "template" : { "$ref" : "#/components/schemas/RestRepositoryRef" } } }, "RestRepositoryRef" : { "type" : "object", "properties" : { "id" : { "type" : "integer", "format" : "int32" }, "project" : { "$ref" : "#/components/schemas/ProjectRef" }, "slug" : { "type" : "string" } }, "description" : "the template repository; just pass its repository ID, e.g., { \"id\" : 1 } OR project key and repository slug, e.g. { \"project\" : { \"key\" : \"PROJECT_1\" }, \"slug\" : \"rep_1\" }" }, "SettingsToUse" : { "type" : "object", "properties" : { "accessKeys" : { "type" : "boolean" }, "autoDecline": { "type": "boolean" }, "autoMergeSettings": { "type": "boolean" }, "branchPermissions" : { "type" : "boolean" }, "codeInsights": { "type": "boolean" }, "defaultReviewersAndReviewerGroups" : { "type" : "boolean", "description": "Requires Repository Permissions to be enabled" }, "jiraIssues": { "type": "boolean" }, "pullRequestSettings" : { "type" : "boolean" }, "pullRequestTemplate" : { "type" : "boolean" }, "repositoryDetails" : { "type" : "boolean" }, "repositoryHooks" : { "type" : "boolean" }, "repositoryHooksToIgnore" : { "type" : "array", "items" : { "type" : "string" } }, "repositoryPermissions" : { "type" : "boolean" }, "requiredBuild": { "type": "boolean" }, "requiredTasks": { "type": "boolean" }, "secretScanning": { "type": "boolean" }, "webhooks" : { "type" : "boolean" }, "workflowBranches": { "type": "boolean" } }, "description" : "choose all settings which should be copied (when creating a new repository with a template) or reset (when you have the periodic settings reset enabled below) from templates to their associated repositories" } } } }