> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # GetBranch # Package: branches # Namespace: BranchesService # Method link: https://dev.wix.com/docs/api-reference/business-management/branches/get-branch.md ## Permission Scopes: Manage Site Branches: SCOPE.DC-DOCUMENT-MANAGEMENT.MANAGE-BRANCHES ## Introduction Retrieves a branch. --- ## REST API ### Schema ``` Method: getBranch Description: Retrieves a branch. URL: https://www.wixapis.com/branches/v1/branches/{branchId} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: branchId Method parameters: param name: branchId | type: none | required: true Return type: GetBranchResponse - name: branch | type: Branch | description: Requested branch. - ONE-OF: - name: sourceBranchProperties | type: SourceBranch | description: Source branch properties. Use when `sourceType` = `SOURCE_BRANCH`. - name: branchId | type: string | description: Source branch GUID. - name: branchRevision | type: string | description: Revision number of the source branch when this branch was created. To prevent conflicting changes, the current revision must be passed when updating the branch. - name: sourceTemplateProperties | type: SourceTemplate | description: Source template properties. Use when `sourceType` = `SOURCE_TEMPLATE`. - name: templateId | type: string | description: Source template GUID. - name: id | type: string | description: Branch GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the branch is updated. To prevent conflicting changes, the current revision must be passed when updating the branch. - name: type | type: Type | description: Branch type. - enum: - USER: A branch created by a site owner that can be accessed for editing and publishing in the editor. - TECHNICAL: A branch created for technical purposes, unrelated to site owners. For internal use, can't be accessed in the editor. - ORIGINAL_BRANCH: The original branch of the site, created when the site is created. Can be accessed for editing and publishing in the editor. - name: name | type: string | description: Branch name. - name: sourceType | type: SourceType | description: Source type for this branch's content. Must be aligned with the corresponding source properties below. - enum: - SOURCE_BRANCH: This branch's source was another branch. Must be used with `sourceBranchProperties`. - name: lastPublishDate | type: string | description: Date and time the branch was last published. - name: editorType | type: EditorType | description: Wix editor type. - name: editorTypeOptions | type: EditorTypeOptions | description: Wix editor types. - enum: - STUDIO: Wix Studio Editor. - CLASSIC: Wix's Classic Editor. - name: default | type: boolean | description: Whether this branch is the default branch. The default branch is used for API operations when no branch GUID is specified. - name: createdDate | type: string | description: Date and time the branch was created. - name: updatedDate | type: string | description: Date and time the branch was last updated. - name: extendedFields | type: ExtendedFields | description: Custom field data for the branch. [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: PublicTags | description: Public tags assigned to the branch. - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. - name: tagIds | type: array | description: List of tag GUIDs. ``` ### Examples ### Get Branch Gets the data about the specified branch ```curl curl -X GET \ 'https://www.wixapis.com/branches/v1/branches/11111111-1111-1111-1111-111111111111' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.branches.BranchesService.getBranch(branchId) Description: Retrieves a branch. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: branchId Method parameters: param name: branchId | type: string | description: GUID of the branch to retrieve. | required: true Return type: PROMISE - ONE-OF: - name: sourceBranchProperties | type: SourceBranch | description: Source branch properties. Use when `sourceType` = `SOURCE_BRANCH`. - name: branchId | type: string | description: Source branch GUID. - name: branchRevision | type: string | description: Revision number of the source branch when this branch was created. To prevent conflicting changes, the current revision must be passed when updating the branch. - name: sourceTemplateProperties | type: SourceTemplate | description: Source template properties. Use when `sourceType` = `SOURCE_TEMPLATE`. - name: templateId | type: string | description: Source template GUID. - name: _id | type: string | description: Branch GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the branch is updated. To prevent conflicting changes, the current revision must be passed when updating the branch. - name: type | type: Type | description: Branch type. - enum: - USER: A branch created by a site owner that can be accessed for editing and publishing in the editor. - TECHNICAL: A branch created for technical purposes, unrelated to site owners. For internal use, can't be accessed in the editor. - ORIGINAL_BRANCH: The original branch of the site, created when the site is created. Can be accessed for editing and publishing in the editor. - name: name | type: string | description: Branch name. - name: sourceType | type: SourceType | description: Source type for this branch's content. Must be aligned with the corresponding source properties below. - enum: - SOURCE_BRANCH: This branch's source was another branch. Must be used with `sourceBranchProperties`. - name: lastPublishDate | type: string | description: Date and time the branch was last published. - name: editorType | type: EditorType | description: Wix editor type. - name: editorTypeOptions | type: EditorTypeOptions | description: Wix editor types. - enum: - STUDIO: Wix Studio Editor. - CLASSIC: Wix's Classic Editor. - name: default | type: boolean | description: Whether this branch is the default branch. The default branch is used for API operations when no branch GUID is specified. - name: _createdDate | type: Date | description: Date and time the branch was created. - name: _updatedDate | type: Date | description: Date and time the branch was last updated. - name: extendedFields | type: ExtendedFields | description: Custom field data for the branch. [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: PublicTags | description: Public tags assigned to the branch. - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. - name: tagIds | type: array | description: List of tag GUIDs. ``` ### Examples ### getBranch ```javascript import { branches } from '@wix/editor-branches'; async function getBranch(branchId) { const response = await branches.getBranch(branchId); }; ``` ### getBranch (with elevated permissions) ```javascript import { branches } from '@wix/editor-branches'; import { auth } from '@wix/essentials'; async function myGetBranchMethod(branchId) { const elevatedGetBranch = auth.elevate(branches.getBranch); const response = await elevatedGetBranch(branchId); } ``` ### getBranch (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { branches } from '@wix/editor-branches'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { branches }, // Include the auth strategy and host as relevant }); async function getBranch(branchId) { const response = await myWixClient.branches.getBranch(branchId); }; ``` ---