<p>Endpoints can pass multiple parameters.  See <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs" rel="nofollow noreferrer">this example</a>, where the <code>start</code> endpoint passes four parameters, as defined in <code>StartParams</code>:</p>
<pre class="lang-shell prettyprint-override"><code>data StartParams = StartParams
    { spDeadline :: !POSIXTime
    , spMinBid   :: !Integer
    , spCurrency :: !CurrencySymbol
    , spToken    :: !TokenName
    } deriving (Generic, ToJSON, FromJSON, ToSchema)
</code></pre>
<p>In the schema declaration is where you ensure that <code>start</code> passes the parameters <code>StartParams</code>:</p>
<pre class="lang-shell prettyprint-override"><code>type AuctionSchema =
        Endpoint &quot;start&quot; StartParams
    .\/ Endpoint &quot;bid&quot;   BidParams
    .\/ Endpoint &quot;close&quot; CloseParams
</code></pre>

CC BY-SA 4.0
2023-02-10T05:14:59.737Z
2023-02-10T05:14:59.737Z
a_juggler
<p>How can add multiple arguments on a certain endpoint?
How can I add more arguments to “start” function? Like “start x y” or “start x y z”?</p>
<pre><code>{-# LANGUAGE ImportQualifiedPost  #-}
{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE DeriveAnyClass        #-}
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude     #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE TypeApplications      #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE TypeOperators         #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE StrictData            #-}

module TEST where

import Data.Text qualified as T
import Playground.Contract
import Plutus.Contract
import PlutusTx.Prelude
import Prelude qualified as Haskell
import qualified PlutusTx.Numeric as PTN
import qualified PlutusTx.Prelude as PTX
import qualified Data.Text        as  T
import qualified PlutusTx.Ratio   as PTR 
import           Prelude                   (String, fromIntegral, ceiling, Float, (*), (-), (/), show, and, const)
import qualified Plutus.Contract as PC
import           Ledger

import           Control.Monad       hiding (fmap)
import           Data.Map            as Map
import           Data.Text           (Text)
import           Data.Void           (Void)
import           PlutusTx            (Data (..))
import qualified PlutusTx
import qualified PlutusTx.Builtins   as Builtins
import           PlutusTx.Prelude    hiding (Semigroup(..), unless)
import           Ledger              hiding (singleton)
import           Ledger.Constraints  as Constraints
import qualified Ledger.Scripts      as Scripts
import           Ledger.Ada          as Ada
import           Playground.Contract (printJson, printSchemas, ensureKnownCurrencies, stage)
import           Playground.TH       (mkKnownCurrencies, mkSchemaDefinitions)
import           Playground.Types    (KnownCurrency (..))
import           Prelude             (IO, Semigroup (..), String)
import           Text.Printf         (printf)
import           Plutus.Contracts.Currency qualified as Currency
import           Data.Text (Text, pack)
import Prelude as Haskell (Int, Semigroup (..), String, div, dropWhile, flip, show, (^), (&lt;&gt;) )

name :: BuiltinByteString
name = &quot;CHOCOLATE&quot;:: BuiltinByteString 

-- start :: forall w s. Integer -&gt; Integer -&gt; Contract w s Text ()
start x  = do
    
    pkh &lt;- Plutus.Contract.ownPaymentPubKeyHash
    cs  &lt;- fmap Currency.currencySymbol $
           mapError (pack . show @Currency.CurrencyError) $
           Currency.mintContract pkh [(TokenName name, x)]
    logInfo @Haskell.String (&quot;RESULTADO: &quot;  Haskell.&lt;&gt; (Haskell.show $ cs) )
    
type DummySchema = Endpoint &quot;start&quot; Integer


endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ start' 
  where
       start'  = PC.endpoint @&quot;start&quot; $ do
                                        \a -&gt; start a


mkSchemaDefinitions ''DummySchema

$(mkKnownCurrencies [])
</code></pre>

<plutus>
How can an endpoint receive multiple argument?
# How can an endpoint receive multiple argument?

(Asked by: username_0 on 2023-01-30)

How can add multiple arguments on a certain endpoint?
How can I add more arguments to “start” function? Like “start x y” or “start x y z”?
{-# LANGUAGE ImportQualifiedPost  #-}
{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE DeriveAnyClass        #-}
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude     #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE TypeApplications      #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE TypeOperators         #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE StrictData            #-}

module TEST where

import Data.Text qualified as T
import Playground.Contract
import Plutus.Contract
import PlutusTx.Prelude
import Prelude qualified as Haskell
import qualified PlutusTx.Numeric as PTN
import qualified PlutusTx.Prelude as PTX
import qualified Data.Text        as  T
import qualified PlutusTx.Ratio   as PTR 
import           Prelude                   (String, fromIntegral, ceiling, Float, (*), (-), (/), show, and, const)
import qualified Plutus.Contract as PC
import           Ledger

import           Control.Monad       hiding (fmap)
import           Data.Map            as Map
import           Data.Text           (Text)
import           Data.Void           (Void)
import           PlutusTx            (Data (..))
import qualified PlutusTx
import qualified PlutusTx.Builtins   as Builtins
import           PlutusTx.Prelude    hiding (Semigroup(..), unless)
import           Ledger              hiding (singleton)
import           Ledger.Constraints  as Constraints
import qualified Ledger.Scripts      as Scripts
import           Ledger.Ada          as Ada
import           Playground.Contract (printJson, printSchemas, ensureKnownCurrencies, stage)
import           Playground.TH       (mkKnownCurrencies, mkSchemaDefinitions)
import           Playground.Types    (KnownCurrency (..))
import           Prelude             (IO, Semigroup (..), String)
import           Text.Printf         (printf)
import           Plutus.Contracts.Currency qualified as Currency
import           Data.Text (Text, pack)
import Prelude as Haskell (Int, Semigroup (..), String, div, dropWhile, flip, show, (^), (<>) )

name :: BuiltinByteString
name = "CHOCOLATE":: BuiltinByteString 

-- start :: forall w s. Integer -> Integer -> Contract w s Text ()
start x  = do
    
    pkh <- Plutus.Contract.ownPaymentPubKeyHash
    cs  <- fmap Currency.currencySymbol $
           mapError (pack . show @Currency.CurrencyError) $
           Currency.mintContract pkh [(TokenName name, x)]
    logInfo @Haskell.String ("RESULTADO: "  Haskell.<> (Haskell.show $ cs) )
    
type DummySchema = Endpoint "start" Integer


endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ start' 
  where
       start'  = PC.endpoint @"start" $ do
                                        \a -> start a


mkSchemaDefinitions ''DummySchema

$(mkKnownCurrencies [])

**Tags:** plutus

---

## 1 answers

### Answer by username_1 on 2023-02-10. Score: 0

Endpoints can pass multiple parameters.  See this example, where the start endpoint passes four parameters, as defined in StartParams:
data StartParams = StartParams
    { spDeadline :: !POSIXTime
    , spMinBid   :: !Integer
    , spCurrency :: !CurrencySymbol
    , spToken    :: !TokenName
    } deriving (Generic, ToJSON, FromJSON, ToSchema)

In the schema declaration is where you ensure that start passes the parameters StartParams:
type AuctionSchema =
        Endpoint "start" StartParams
    .\/ Endpoint "bid"   BidParams
    .\/ Endpoint "close" CloseParams


---

