openapi: 3.0.3
info:
  title: Mobile Api Documentation
  description: Mobile Api Documentation
  version: '3.0'
servers:
  - url: https://testnet.rarible.com
  - url: https://rarible.com
paths:
  /marketplace/mobile/api/v3/item/{itemId}:
    get:
      tags:
        - item
      summary: get single item
      parameters:
        - in: path
          name: itemId
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            'application/json':
              schema:
                $ref: '#/components/schemas/ItemResponse'

  /marketplace/mobile/api/v3/portfolio:
    post:
      tags:
        - portfolio
      summary: portfolio information
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PortfolioRequestBody'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioResponse'

  /marketplace/mobile/api/v3/collection/{collectionId}:
    get:
      tags:
        - collection
      summary: information about collection
      parameters:
        - in: path
          name: collectionId
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionResponse'

  /marketplace/mobile/api/v3/collection/{collectionId}/info:
    get:
      tags:
        - collection
      summary: information about collection without statistics (statistics field will be null!)
      parameters:
        - in: path
          name: collectionId
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionResponse'

  /marketplace/mobile/api/v3/collection/{collectionId}/stats:
    get:
      tags:
        - collection
      summary: statistics for the collection
      parameters:
        - in: path
          name: collectionId
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionStatisticsResponse'

  /marketplace/mobile/api/v3/collection/{collectionId}/listed:
    post:
      tags:
        - collection
      summary: information about listings
      parameters:
        - in: path
          name: collectionId
          required: true
          style: simple
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionListedRequestBody'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionListedResponse'
          headers:
            X-CONTINUATION:
              $ref: '#/components/headers/X-CONTINUATION'

  /marketplace/mobile/api/v3/collection/{collectionId}/owners:
    post:
      tags:
        - collection
      summary: information about owners
      parameters:
        - in: path
          name: collectionId
          required: true
          style: simple
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionOwnersRequestBody'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionOwnersResponse'
          headers:
            X-CONTINUATION:
              $ref: '#/components/headers/X-CONTINUATION'

  /marketplace/mobile/api/v3/trending:
    get:
      tags:
        - trending
      summary: trending collections
      parameters:
        - name: period
          in: query
          required: true
          style: form
          schema:
            type: string
            enum:
              - hour
              - week
              - month
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrendingResponse'

  /marketplace/mobile/api/v3/search:
    get:
      tags:
        - search
      summary: search
      parameters:
        - name: prefix
          in: query
          required: true
          style: form
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'

  /marketplace/mobile/api/v3/collection/items:
    post:
      tags:
        - collection
      summary: items in collection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionItemsRequestBody'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionItemsResponse'
          headers:
            X-CONTINUATION:
              $ref: '#/components/headers/X-CONTINUATION'

  /marketplace/mobile/api/v3/watchlist/collections:
    get:
      tags:
        - watchlist
      summary: watchlist collections
      parameters:
        - name: ids
          in: query
          required: true
          style: form
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrendingResponse'

  /marketplace/mobile/api/v3/watchlist/items:
    get:
      tags:
        - watchlist
      summary: watchlist items
      parameters:
        - name: ids
          in: query
          required: true
          style: form
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionItemsResponse'

  /marketplace/mobile/api/v3/collection/stats:
    post:
      tags:
        - collection
      summary: collections stats
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CollectionStatsResponse'

  /marketplace/mobile/api/v3/profile:
    get:
      tags:
        - profile
      summary: new profile
      parameters:
        - name: userId
          in: query
          required: true
          style: form
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileResponse'

  /marketplace/mobile/api/v3/profile/totalFloorUsd:
    get:
      tags:
        - profile
      summary: new profile total floor in usd
      parameters:
        - name: userId
          in: query
          required: true
          style: form
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileTotalFloorUsdResponse'

  /marketplace/mobile/api/v3/profile/collections:
    get:
      tags:
        - profile
      summary: collection ids for user and ordered by floorPrice
      parameters:
        - name: userId
          in: query
          required: true
          style: form
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileCollectionsResponse'

  /marketplace/mobile/api/v3/profile/collections/detail:
    get:
      tags:
        - profile
      summary: collections detail for user
      parameters:
        - name: userId
          in: query
          required: true
          style: form
          schema:
            type: string
        - name: collectionIds
          in: query
          required: true
          style: form
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileCollectionsDetailResponse'

  /marketplace/mobile/api/v3/profile/items/minted:
    get:
      tags:
        - profile
      summary: minted items by user
      parameters:
        - name: userId
          in: query
          required: true
          style: form
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileItemsResponse'

  /marketplace/mobile/api/v3/profile/items/listed:
    get:
      tags:
        - profile
      summary: listed items by user
      parameters:
        - name: userId
          in: query
          required: true
          style: form
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileItemsResponse'

components:
  headers:
    X-CONTINUATION:
      description: Continuation for next request
      schema:
        type: string
      example: { "params": [ ],"from": 1 }
  schemas:
    ItemResponse:
      type: object
      required:
        - id
        - media
        - name
        - description
        - blockchain
        - listedCount
        - totalCount
        - owner
        - collection
      properties:
        id:
          type: string
        media:
          type: array
          items:
            $ref: '#/components/schemas/MediaEntry'
        name:
          type: string
        description:
          type: string
        offer:
          $ref: '#/components/schemas/MoneyResponse'
        price:
          $ref: '#/components/schemas/MoneyResponse'
        auction:
          $ref: '#/components/schemas/AuctionResponse'
        lastSellPrice:
          $ref: '#/components/schemas/MoneyResponse'
        blockchain:
          $ref: '#/components/schemas/Blockchain'
        listedCount:
          type: integer
        totalCount:
          type: integer
        owner:
          $ref: '#/components/schemas/ItemOwnerResponse'
        collection:
          $ref: '#/components/schemas/ItemCollectionResponse'
        rarity:
          $ref: '#/components/schemas/RarityResponse'

    ItemCollectionResponse:
      type: object
      required:
        - id
        - name
        - isVerified
      properties:
        id:
          type: string
        name:
          type: string
        floorPrice:
          $ref: '#/components/schemas/MoneyResponse'
        avatar:
          $ref: '#/components/schemas/ImageResponse'
        isVerified:
          type: boolean

    ItemOwnerResponse:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
        name:
          type: string
        avatar:
          $ref: '#/components/schemas/ImageResponse'

    ImageResponse:
      type: object
      properties:
        previewUrl:
          type: string
        originalUrl:
          type: string

    AuctionResponse:
      type: object
      required:
        - minPrice
        - start
        - end
        - status
        - currency
      properties:
        minPrice:
          type: number
        start:
          type: string
          format: date
        end:
          type: string
          format: date
        status:
          $ref: '#/components/schemas/AuctionStatus'
        currency:
          type: string

    AuctionStatus:
      type: string
      enum:
        - ENDED
        - NOT_STARTED
        - STARTED

    MoneyResponse:
      type: object
      required:
        - value
        - currency
      properties:
        value:
          type: number
        currency:
          type: string

    RarityResponse:
      type: object
      required:
        - rank
        - maxRank
      properties:
        rank:
          type: integer
        maxRank:
          type: integer

    Blockchain:
      type: string
      enum:
        - ETHEREUM
        - FLOW
        - POLYGON
        - TEZOS
        - SOLANA
        - IMMUTABLEX

    Platform:
      type: string
      enum:
        - RARIBLE
        - OPEN_SEA
        - CRYPTO_PUNKS
        - IMMUTABLEX
        - OBJKT
        - HEN
        - LOOKSRARE
        - X2Y2

    MediaEntry:
      type: object
      required:
        - url
        - sizeType
        - contentType
      properties:
        url:
          type: string
        sizeType:
          $ref: '#/components/schemas/MediaEntrySizeType'
        contentType:
          $ref: '#/components/schemas/MediaEntryContentType'

    MediaEntrySizeType:
      type: string
      enum:
        - ORIGINAL
        - PREVIEW
        - BIG
        - MOBILE_LOW
        - MOBILE_MEDIUM
        - MOBILE_HIGH
        - SOURCE
        - EXTRA_SOURCE

    MediaEntryContentType:
      type: string
      enum:
        - IMAGE
        - VIDEO

    PortfolioResponse:
      type: object
      required:
        - totalValue
        - collections
      properties:
        totalValue:
          type: object
          required:
            - sum
            - usdSum
            - isAccurate
          properties:
            sum:
              $ref: '#/components/schemas/MoneyResponse'
            usdSum:
              $ref: '#/components/schemas/MoneyResponse'
            isAccurate:
              type: boolean
        collections:
          type: array
          items:
            $ref: '#/components/schemas/PortfolioCollection'

    PortfolioCollection:
      type: object
      required:
        - id
        - title
        - count
        - sum
        - usdSum
        - isExcluded
        - isPinned
        - isSmallVolume
        - isSmallFloor
        - previewItems
      properties:
        id:
          type: string
        title:
          type: string
        avatar:
          $ref: '#/components/schemas/ImageResponse'
        count:
          type: integer
        sum:
          $ref: '#/components/schemas/MoneyResponse'
        usdSum:
          $ref: '#/components/schemas/MoneyResponse'
        isExcluded:
          type: boolean
        isPinned:
          type: boolean
        isSmallVolume:
          type: boolean
        isSmallFloor:
          type: boolean
        previewItems:
          type: array
          items:
            type: object
            required:
              - id
            properties:
              id:
                type: string
              image:
                $ref: '#/components/schemas/ImageResponse'

    PortfolioRequestBody:
      type: object
      required:
        - blockchain
        - address
        - excludedCollections
        - pinnedCollections
      properties:
        blockchain:
          type: string
        address:
          type: string
        excludedCollections:
          type: array
          items:
            type: string
        pinnedCollections:
          type: array
          items:
            type: string

    CollectionResponse:
      type: object
      required:
        - id
        - name
        - description
        - isVerified
        - blockchain
        - raribleLink
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        avatar:
          $ref: '#/components/schemas/ImageResponse'
        cover:
          $ref: '#/components/schemas/ImageResponse'
        isVerified:
          type: boolean
        blockchain:
          $ref: '#/components/schemas/Blockchain'
        statistics:
          $ref: '#/components/schemas/CollectionStatisticsResponse'
        raribleLink:
          type: string
          format: url

    CollectionStatisticsResponse:
      type: object
      required:
        - totalVolume
        - ownersCount
        - totalCount
        - listedCount
      properties:
        floorPrice:
          $ref: '#/components/schemas/MoneyResponse'
        totalVolume:
          $ref: '#/components/schemas/MoneyResponse'
        ownersCount:
          type: integer
        totalCount:
          type: integer
        listedCount:
          type: integer

    CollectionListedRequestBody:
      type: object
      properties:
        continuation:
          type: string
        size:
          type: integer

    CollectionListedResponse:
      type: array
      items:
        type: object
        required:
          - id
          - name
          - date
          - type
        properties:
          id:
            type: string
          name:
            type: string
          avatar:
            $ref: '#/components/schemas/ImageResponse'
          price:
            $ref: '#/components/schemas/MoneyResponse'
          date:
            type: string
            format: date
          type:
            type: string

    CollectionOwnersRequestBody:
      type: object
      properties:
        continuation:
          type: string
        size:
          type: integer

    CollectionOwnersResponse:
      type: array
      items:
        type: object
        required:
          - id
          - date
        properties:
          id:
            type: string
          name:
            type: string
          avatar:
            $ref: '#/components/schemas/ImageResponse'
          date:
            type: string
            format: date

    TrendingResponse:
      type: array
      items:
        type: object
        required:
          - id
          - name
          - isVerified
          - items
        properties:
          id:
            type: string
          name:
            type: string
          avatar:
            $ref: '#/components/schemas/ImageResponse'
          volume:
            $ref: '#/components/schemas/MoneyResponse'
          volumeDelta:
            type: number
            format: float
          isVerified:
            type: boolean
          floorPrice:
            $ref: '#/components/schemas/MoneyResponse'
          items:
            type: array
            items:
              type: object
              required:
                - id
              properties:
                id:
                  type: string
                platform:
                  $ref: '#/components/schemas/Platform'
                image:
                  $ref: '#/components/schemas/ImageResponse'
                price:
                  $ref: '#/components/schemas/MoneyResponse'

    SearchResponse:
      type: object
      required:
        - collections
        - items
        - users
      properties:
        collections:
          type: array
          items:
            $ref: '#/components/schemas/CollectionSearchResponse'
        items:
          type: array
          items:
            $ref: '#/components/schemas/ItemSearchResponse'
        users:
          type: array
          items:
            $ref: '#/components/schemas/UserSearchResponse'

    CollectionSearchResponse:
      type: object
      required:
        - id
        - isVerified
      properties:
        id:
          type: string
        name:
          type: string
        avatar:
          $ref: '#/components/schemas/ImageResponse'
        isVerified:
          type: boolean

    ItemSearchResponse:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
        name:
          type: string
        image:
          $ref: '#/components/schemas/ImageResponse'

    UserSearchResponse:
      type: object
      required:
        - id
        - isVerified
      properties:
        id:
          type: string
        name:
          type: string
        avatar:
          $ref: '#/components/schemas/ImageResponse'
        isVerified:
          type: boolean

    CollectionItemsRequestBody:
      type: object
      required:
        - collectionId
      properties:
        collectionId:
          type: string
        ownerAddress:
          type: string
        sort:
          type: string
          enum:
            - DEFAULT
            - LATEST
            - LOW_PRICE_FIRST
            - HIGH_PRICE_FIRST
        traits:
          type: array
          items:
            $ref: '#/components/schemas/ItemTrait'
        continuation:
          type: string

    ItemTrait:
      type: object
      required:
        - key
        - values
      properties:
        key:
          type: string
        values:
          type: array
          items:
            type: string

    CollectionItemsResponse:
      type: array
      items:
        $ref: '#/components/schemas/ItemCardResponse'

    ItemCardResponse:
      type: object
      required:
        - id
        - name
        - isVideo
      properties:
        id:
          type: string
        name:
          type: string
        image:
          $ref: '#/components/schemas/ImageResponse'
        offer:
          $ref: '#/components/schemas/MoneyResponse'
        price:
          $ref: '#/components/schemas/MoneyResponse'
        isVideo:
          type: boolean
        platform:
          $ref: '#/components/schemas/Platform'

    CollectionStatsResponse:
      type: object
      required:
        - id
        - name
        - floorPrice
      properties:
        id:
          type: string
        name:
          type: string
        floorPrice:
          $ref: '#/components/schemas/MoneyResponse'

    ProfileResponse:
      type: object
      required:
        - id
        - address
      properties:
        id:
          type: string
        address:
          type: string
        avatar:
          $ref: '#/components/schemas/ImageResponse'

    ProfileTotalFloorUsdResponse:
      type: object
      required:
        - totalFloorUsd
      properties:
        totalFloorUsd:
          type: number

    ProfileCollectionsResponse:
      type: object
      required:
        - userId
        - collectionIds
      properties:
        userId:
          type: string
        collectionIds:
          type: array
          items:
            type: string

    ProfileCollectionsDetailResponse:
      type: array
      items:
        type: object
        required:
          - id
          - name
          - isVerified
          - items
          - isSmallVolume
          - isSmallFloor
          - itemsCount
        properties:
          id:
            type: string
          name:
            type: string
          avatar:
            $ref: '#/components/schemas/ImageResponse'
          volume:
            $ref: '#/components/schemas/MoneyResponse'
          isVerified:
            type: boolean
          floorPrice:
            $ref: '#/components/schemas/MoneyResponse'
          isSmallVolume:
            type: boolean
          isSmallFloor:
            type: boolean
          itemsCount:
            type: number
          items:
            $ref: '#/components/schemas/ProfileItemsResponse'

    ProfileItemsResponse:
      type: array
      items:
        $ref: '#/components/schemas/ProfileItemResponse'

    ProfileItemResponse:
      type: object
      required:
        - id
      properties:
        id:
          type: string
        platform:
          $ref: '#/components/schemas/Platform'
        image:
          $ref: '#/components/schemas/ImageResponse'
        price:
          $ref: '#/components/schemas/MoneyResponse'
