> 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

# getCategory

# Package: @wix/blog

# Namespace: categories

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/blog/category/get-category.md

## Permission Scopes:
Read Blog : SCOPE.DC-BLOG.READ-BLOGS

## Introduction

Gets a category with the specified ID.

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.blog.categories.getCategory(categoryId, options)
 Description: Gets a category with the specified GUID.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  categoryId
 Method parameters: 
   param name: categoryId | type: string | description: Category GUID. | required: true | validation: minLength 1, maxLength 38
   param name: options | type: GetCategoryOptions  none  
        - name: fieldsets | type: array<Field> | description: List of additional category fields to include in the response. By default only the category’s base fields are returned. Base fields are all category fields that don't appear in the fieldset enum.  To retrieve a field, pass the relevant fieldset in the enum in the `fieldsets` array. For example, add the `URL` fieldset to `fieldsets` to retrieve the url field in the response in addition to the category’s base fields.  | validation: maxItems 10
             - enum:
             -     UNKNOWN: 
             -     URL: Includes category URL.
             -     SEO: Includes SEO data.
 Return type: PROMISE<GetCategoryResponse>
  - name: category | type: Category | description: Category info.  
     - name: _id | type: string | description: Category GUID.  | validation: maxLength 38, immutable
     - name: label | type: string | description: Category label. Displayed in the Category Menu.  | validation: maxLength 35
     - name: postCount | type: integer | description: Number of posts in the category.  | read-only: true 
     - name: url | type: string | description: The `url` of the page that lists every post with the specified category.  | read-only: true 
     - name: description | type: string | description: Category description.  | validation: maxLength 500
     - name: displayPosition | type: integer | description: Position of the category in the [Category Menu](https://support.wix.com/en/article/wix-blog-adding-and-customizing-a-category-menu). Categories are displayed in ascending order. Categories with a position of `-1` appear at the end of the sequence.  Default: `-1`  | validation: minimum 0, format int32
     - name: translationId | type: string | description: GUID of the category's translations. All translations of a single category share the same `translationId`.  | validation: format GUID
     - name: language | type: string | description: Category language.  2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.  | validation: immutable
     - name: slug | type: string | description: Part of a category's URL that refers to a specific category. For example, the slug of `https:/example.com/blog/category/famous-cats` is `famous-cats`.  | validation: maxLength 100
     - name: seoData | type: SeoSchema | description: SEO data.  
        - name: tags | type: array<Tag> | description: SEO tag information.  
           - name: type | type: string | description: SEO tag type.   Supported values: `title`, `meta`, `script`, `link`.  Which of these an API actually accepts depends on where the tag is being set: this list is not a blanket guarantee across every API that reuses this message. Site SEO Tags in particular accepts only `meta` (see `SiteSeoTags.tags`) and rejects `title`/`script`/`link` with a validation error even though they appear here — check the field description of the specific `tags`-typed field you're writing to for the types it actually supports and the error it returns.  Limitation: `title` and `script` (e.g. a `script` tag with `props.type` `"application/ld+json"` carrying structured data) are supported only when `custom` is unset or `false`. Setting `custom: true` on a `title` or `script` tag is rejected with `TAG_TYPE_NOT_ALLOWED`, because `custom: true` routes the write through the site's Advanced/Custom Tags list. To write structured data, omit `custom` (or set it to `false`).  
           - name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`.  
           - name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`.  
           - name: children | type: string | description: SEO tag inner content. For example, `<title> inner content </title>`.  
           - name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages) — i.e. an entry from the site's Advanced/Custom Tags list.  Setting this to `true` on a write restricts which `type` values are accepted — the same restriction the Advanced/Custom Tags UI enforces. `title` and `script` tags (including JSON-LD structured data) must be sent with `custom` omitted or `false`; sending them with `custom: true` is rejected with `TAG_TYPE_NOT_ALLOWED`.  Note this is a separate restriction from Site SEO Tags' own type restriction on `SiteSeoTags.tags`: even with `custom` unset, Site SEO Tags rejects `script` (e.g. for site-wide structured data) unconditionally. There is currently no way to set site-wide, every-page structured data through any of these APIs — write a per-page `script` tag through the Item SEO Tags API instead.  This flag is scoped to that feature only. It is NOT an indicator of whether a standard tag (`title`, `description`, Open Graph, etc.) reflects a manually configured value versus a computed default/pattern — standard tags always resolve with `custom: false`, even when their content comes from a page's manually saved SEO title/description override. Don't use this field to verify whether a live page reflects a manual per-page SEO edit.  Limitation: when `ResolveStaticPageSeoTags` is called without `seoData`, the per-page SEO data is read only from the Vibe/Wix-managed-headless override store. That store holds nothing for classic Wix Editor or Wix Studio pages, so even genuine Advanced/Custom Tags saved on those pages are missing from the response entirely — there, `false` means this API could not tell, not that no custom tag exists. Pass `seoData` explicitly to resolve against a known set of tags.  
           - name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines.  
        - name: settings | type: Settings | description: SEO general settings.  
           - name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled.   Default: `false` (automatical redirect is enabled).  
           - name: keywords | type: array<Keyword> | description: User-selected keyword terms for a specific page.  | validation: maxItems 5
              - name: term | type: string | description: Keyword value.  
              - name: isMain | type: boolean | description: Whether the keyword is the main focus keyword.  
              - name: origin | type: string | description: The source that added the keyword terms to the SEO settings.  | validation: maxLength 1000
     - name: coverImage | type: string | description: Category cover image.  
     - name: _updatedDate | type: Date | description: Date and time the Category was last updated.  | read-only: true 


```

### Examples

### Get a category by ID with additional fields
```javascript
import { categories } from '@wix/blog';

/* Sample categoryId value:
 * 'f489bf39-3297-4854-8429-e19dbefdca0e'
 *
 * Sample options value:
 * {
 *   fieldsets: [
 *     'URL',
 *     'SEO'
 *   ]
 * }
 */

export async function getCategoryFunction(categoryId, options) {
  try {
    const result = await categories.getCategory(categoryId, options);
    const label = result.category.label;
    const url = result.category.url;
    console.log('Retrieved Result:', result);
    return result;
  } catch (error) {
    console.error(error);
  }
}

/* Promise resolves to:
 * {
 *   "category": {
 *     "_id": "f489bf39-3297-4854-8429-e19dbefdca0e",
 *     "coverImage": "wix:image://v1/162e66_f6bffd1cd6144ddf87325b82fe8f42ed~mv2.jpg#originWidth=385&originHeight=245",
 *     "description": "my category description",
 *     "displayPosition": 0,
 *     "label": "My Category",
 *     "language": "en",
 *     "postCount": 1,
 *     "seoData": {
 *       "tags": [
 *         {
 *           "type": "meta",
 *           "props": {
 *             "name": "description",
 *             "content": "this is a category description"
 *           },
 *           "children": "",
 *           "custom": false,
 *           "disabled": false
 *         }
 *       ]
 *     },
 *     "slug": "my-category",
 *     "title": "My Category",
 *     "translationId": "dfc5b1a7-df04-4596-b311-9724f0477c3e",
 *     "url" : "http://https://tadasz7.wixsite.com/blog-velo-events/my-blog/categories/my-category"
 *   }
 * }
 */
```

### Get a category by ID
```javascript
import { categories } from '@wix/blog';

/* Sample categoryId value:
 * 'f489bf39-3297-4854-8429-e19dbefdca0e'
 */

export async function getCategoryFunction(categoryId) {
  try {
    const result = await categories.getCategory(categoryId);
    const label = result.category.label;
    const slug = result.category.slug;
    console.log('Retrieved Result:', result);
    return result;
  } catch (error) {
    console.error(error);
  }
}

/* Promise resolves to:
 * {
 *   "category": {
 *     "_id": "f489bf39-3297-4854-8429-e19dbefdca0e",
 *     "coverImage": "wix:image://v1/162e66_f6bffd1cd6144ddf87325b82fe8f42ed~mv2.jpg#originWidth=385&originHeight=245",
 *     "description": "my category description",
 *     "displayPosition": 0,
 *     "label": "My Category",
 *     "language": "en",
 *     "postCount": 1,
 *     "slug": "my-category",
 *     "title": "My Category",
 *     "translationId": "dfc5b1a7-df04-4596-b311-9724f0477c3e"
 *   }
 * }
 */
```

### getCategory (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 { categories } from '@wix/blog';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { categories },
  // Include the auth strategy and host as relevant
});


async function getCategory(categoryId,options) {
  const response = await myWixClient.categories.getCategory(categoryId,options);
};
```

---