> ## Documentation Index
> Fetch the complete documentation index at: https://andcze.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Utwórz produkt



## OpenAPI

````yaml /openapi.pl.json post /api/v2/products/{shopId}
openapi: 3.0.0
info:
  title: ItemShop v2 API
  description: >-
    REST API platformy ItemShop v2 (NestJS + Fastify). Wszystkie ścieżki mają
    prefiks /api/v2.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.itemshop.dev
    description: Produkcja
  - url: http://localhost:3000
    description: Lokalnie
security: []
tags: []
paths:
  /api/v2/products/{shopId}:
    post:
      tags:
        - Products
      summary: Utwórz produkt
      operationId: ProductController_createProduct
      parameters:
        - name: shopId
          required: true
          in: path
          schema:
            type: string
          description: ID sklepu (ObjectId)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductDto'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Product'
                  message:
                    type: string
        '400':
          description: Błędne dane wejściowe
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Brak/niepoprawne uwierzytelnienie
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Brak uprawnień / dostępu
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Nie znaleziono
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Przekroczony limit żądań
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    CreateProductDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: Nazwa produktu
          example: Ranga VIP
        serverId:
          type: string
          description: ID serwera (ObjectId)
          example: 664f1a2b3c4d5e6f7a8b9c0e
        price:
          type: number
          minimum: 0
          description: Cena
          example: 19.99
        commands:
          minItems: 1
          description: Komendy do wykonania (z placeholderami)
          example:
            - lp user {PLAYER} parent set vip
          type: array
          items:
            type: string
        description:
          type: string
          minLength: 0
          maxLength: 5000
          description: Opis (HTML/markdown)
        shortDescription:
          type: string
          minLength: 0
          maxLength: 500
          description: Krótki opis
        translations:
          type: object
          description: Tłumaczenia per język (klucz = kod ISO)
        images:
          description: Bezpośrednie linki do zdjęć
          type: array
          items:
            type: string
        compareAtPrice:
          type: number
          minimum: 0
          description: Cena przed promocją
          example: 29.99
        sku:
          type: string
          minLength: 0
          maxLength: 100
          description: SKU
        requirements:
          description: Wymagania
          allOf:
            - $ref: '#/components/schemas/RequirementsDto'
        inventory:
          description: Magazyn
          allOf:
            - $ref: '#/components/schemas/InventoryDto'
        isActive:
          type: boolean
          description: Czy aktywny
        isFeatured:
          type: boolean
          description: Wyróżniony
        sortOrder:
          type: number
          description: Kolejność sortowania
        pricingMode:
          enum:
            - variants
            - quantity
          type: string
          description: 'Tryb sprzedaży: warianty albo ilość (suwak)'
        minQuantity:
          type: number
          minimum: 1
          description: Minimalna ilość (suwak)
          example: 1
        maxQuantity:
          type: number
          minimum: 1
          description: Maksymalna ilość (suwak)
          example: 64
        stepQuantity:
          type: number
          minimum: 1
          description: Krok suwaka ilości
          example: 1
        variants:
          description: Warianty do wyboru
          type: array
          items:
            $ref: '#/components/schemas/VariantDto'
        packageSuggestions:
          description: Sugestie pakietów (kafelki pod suwakiem)
          type: array
          items:
            $ref: '#/components/schemas/PackageSuggestionDto'
        paymentMethods:
          description: Przypisane metody płatności
          type: array
          items:
            $ref: '#/components/schemas/ProductPaymentMethodDto'
      required:
        - name
        - serverId
        - price
        - commands
    Product:
      type: object
      properties:
        _id:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        name:
          type: string
          example: Ranga VIP
        slug:
          type: string
          example: ranga-vip
        price:
          type: number
          example: 19.99
        serverId:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        shopId:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        commands:
          type: array
          items:
            type: string
          example:
            - lp user {PLAYER} parent set vip
        isActive:
          type: boolean
          example: true
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          example: 400
        error:
          type: string
          example: Komunikat błędu
        timestamp:
          type: string
          format: date-time
        path:
          type: string
          example: /api/v2/...
    RequirementsDto:
      type: object
      properties:
        requirePlayerOnline:
          type: boolean
          description: Wymagaj gracza online
        minecraftVersion:
          type: string
          description: Wersja Minecraft
        permissions:
          description: Wymagane uprawnienia
          type: array
          items:
            type: string
    InventoryDto:
      type: object
      properties:
        trackQuantity:
          type: boolean
          description: Śledź stan magazynowy
        quantity:
          type: number
          minimum: 0
          description: Dostępna ilość
          example: 100
        allowBackorder:
          type: boolean
          description: Zezwól na zamówienia mimo braku
    VariantDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 80
          description: Nazwa wariantu
          example: VIP 30 dni
        price:
          type: number
          minimum: 0
          description: Cena wariantu
          example: 19.99
        commands:
          description: Komendy wariantu
          type: array
          items:
            type: string
        description:
          type: string
          minLength: 0
          maxLength: 500
          description: Opis wariantu
        image:
          type: string
          minLength: 0
          maxLength: 2000
          description: URL zdjęcia wariantu
        paymentMethods:
          description: Nadpisania ceny per metoda płatności
          type: array
          items:
            $ref: '#/components/schemas/ProductPaymentMethodDto'
      required:
        - name
        - price
    PackageSuggestionDto:
      type: object
      properties:
        quantity:
          type: number
          minimum: 1
          description: Ilość pakietu
          example: 50
        bonus:
          type: number
          minimum: 0
          description: Bonus (darmowe sztuki)
          example: 5
      required:
        - quantity
    ProductPaymentMethodDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 80
          description: Nazwa metody płatności
          example: imojeTransfer
        priceOverride:
          type: number
          minimum: 0
          description: Nadpisanie ceny dla tej metody
          example: 12.99
      required:
        - name
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    bearerAuth:
      scheme: bearer
      bearerFormat: JWT
      type: http

````