# Material subcategories

## Get material subcategories

> The API gives the ability to get all subcategories of material category.

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PaginatedResult":{"type":"object","properties":{"data":{"description":"Array of data items","type":"array","items":{"type":"array"}},"meta":{"description":"Pagination metadata","allOf":[{"$ref":"#/components/schemas/PaginationMetadata"}]}},"required":["data","meta"]},"PaginationMetadata":{"type":"object","properties":{"total":{"type":"number","description":"Total number of items"},"lastPage":{"type":"number","description":"Last page number"},"currentPage":{"type":"number","description":"Current page number"},"perPage":{"type":"number","description":"Items per page"},"prev":{"type":"number","description":"Previous page number","nullable":true},"next":{"type":"number","description":"Next page number","nullable":true}},"required":["total","lastPage","currentPage","perPage","prev","next"]},"PublicMaterialSubcategoryDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the subcategory"},"name":{"type":"string","description":"Subcategory name"},"created_at":{"format":"date-time","type":"string","description":"Time when the subcategory was created"},"updated_at":{"type":"object","nullable":true,"description":"Time when the subcategory was last updated, null if never updated"},"material_category_id":{"type":"string","description":"Identifier of the parent material category this subcategory belongs to"}},"required":["id","name","created_at","material_category_id"]}}},"paths":{"/api/v1/public/material-categories/{id}/subcategories":{"get":{"description":"The API gives the ability to get all subcategories of material category.","operationId":"PublicMaterialSubcategoryController_searchSubcategories_v1","parameters":[{"name":"id","required":true,"in":"path","description":"Material category id","schema":{"type":"string"}},{"name":"skip","required":false,"in":"query","description":"","schema":{"type":"number"}},{"name":"take","required":false,"in":"query","description":"","schema":{"type":"number"}},{"name":"name","required":false,"in":"query","description":"","schema":{"type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResult"},{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicMaterialSubcategoryDto"}}}}]}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Get material subcategories","tags":["Material subcategories"]}}}}
```

## Create material subcategory

> The API gives the ability to create new subcategory within a category.

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicCreateMaterialSubcategoryDto":{"type":"object","properties":{"name":{"type":"string","description":"Subcategory name"}},"required":["name"]},"PublicMaterialSubcategoryDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the subcategory"},"name":{"type":"string","description":"Subcategory name"},"created_at":{"format":"date-time","type":"string","description":"Time when the subcategory was created"},"updated_at":{"type":"object","nullable":true,"description":"Time when the subcategory was last updated, null if never updated"},"material_category_id":{"type":"string","description":"Identifier of the parent material category this subcategory belongs to"}},"required":["id","name","created_at","material_category_id"]}}},"paths":{"/api/v1/public/material-categories/{id}/subcategories":{"post":{"description":"The API gives the ability to create new subcategory within a category.","operationId":"PublicMaterialSubcategoryController_create_v1","parameters":[{"name":"id","required":true,"in":"path","description":"Material category id","schema":{"type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCreateMaterialSubcategoryDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicMaterialSubcategoryDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Create material subcategory","tags":["Material subcategories"]}}}}
```

## Delete material subcategory

> The API gives the ability to delete subcategory.

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"MessageDto":{"type":"object","properties":{"message":{"type":"string","description":"Message returned from API confirming the operation"}},"required":["message"]}}},"paths":{"/api/v1/public/material-categories/{id}/subcategories/{subcategory_id}":{"delete":{"description":"The API gives the ability to delete subcategory.","operationId":"PublicMaterialSubcategoryController_delete_v1","parameters":[{"name":"id","required":true,"in":"path","description":"Material category id","schema":{"type":"string"}},{"name":"subcategory_id","required":true,"in":"path","description":"Material subcategory id","schema":{}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Delete material subcategory","tags":["Material subcategories"]}}}}
```

## Update material subcategory

> The API gives the ability to update an existing subcategory’s name.

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicUpdateMaterialSubcategoryDto":{"type":"object","properties":{"name":{"type":"string","description":"Subcategory name"}},"required":["name"]},"MessageDto":{"type":"object","properties":{"message":{"type":"string","description":"Message returned from API confirming the operation"}},"required":["message"]}}},"paths":{"/api/v1/public/material-categories/{id}/subcategories/{subcategory_id}":{"patch":{"description":"The API gives the ability to update an existing subcategory’s name.","operationId":"PublicMaterialSubcategoryController_update_v1","parameters":[{"name":"id","required":true,"in":"path","description":"Material category id","schema":{"type":"string"}},{"name":"subcategory_id","required":true,"in":"path","description":"Material subcategory id","schema":{}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicUpdateMaterialSubcategoryDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Update material subcategory","tags":["Material subcategories"]}}}}
```
