# A contract has two signers. I want to archive the contract through JsonAPI. How should the token be assembled?

**URL:** <https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053>\
**Category:** App Development\
**Created:** [February 1, 2023, 10:53am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053 "2023-02-01T10:53:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 1, 2023, 10:53am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/1 "2023-02-01T10:53:01Z")

</div>

This is the error message

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/7/70bc6ce3513196031884d97d2995dc54b11fc282.png)

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/e/ed1afbefe72d770cbdffbe283736c9c7ec4f6f36.png)

This is the error message for using another token

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/c/c481982bc103dab1a741c44f97175f7f2f521e05.png)  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/4/49cf3f11de082cfb17a7be5228893be4faec7631.png)

---

<div class="post-metadata">

**Author:** ![WallaceKelly](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/wallacekelly/32/5046_2.png) [@WallaceKelly](https://forum.canton.network/u/WallaceKelly)\
**Post date:** [February 1, 2023, 7:48pm UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/2 "2023-02-01T19:48:38Z")

</div>

Hi, @skylorna.

Your first screenshots show that in the first case, you did not have sufficient authorization.

Your second screenshots show that in the second case, after fixing the authorization issue, you ran into a second issue, summarized by “malformed request.”

I don’t know for sure, but I would start by examining the payload JSON that you are sending to the endpoint. It might be that the payload JSON does not match the expected input for the endpoint you are calling.

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 2, 2023, 1:01am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/3 "2023-02-02T01:01:47Z")

</div>

Hi @WallaceKelly this is my Json ,I archived all other contracts with only one signer using this json, only contracts with 2 signers won’t work

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/9/949d1b08063d2cb0e02def64332e309871c3f33e.png)

---

<div class="post-metadata">

**Author:** ![WallaceKelly](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/wallacekelly/32/5046_2.png) [@WallaceKelly](https://forum.canton.network/u/WallaceKelly)\
**Post date:** [February 2, 2023, 1:40pm UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/4 "2023-02-02T13:40:02Z")

</div>

Everything looks correct in your screenshots. I tried to reproduce the issue on my machine, but was not able to. Below are the steps I took. Perhaps this will help us identify what might be going on…

Using Daml 2.5.1.

1. `daml new ArchiveTest`
2. `cd ArchiveTest`
3. `daml studio`
4. Edit the Main.daml to require two signatories. (See code below.)
5. `daml start`
6. In Navigator, grab the ids for Alice, Bob, the template, and the contract.
7. At [http://jwt.io](http://jwt.io), create a JWT payload with Alice’s and Bob’s ids. (See payload below.)
8. In Postman, create a GET request to `http://localhost:7575/v1/exercise`. Use the encoded JWT token for the authorization, bearer token. Set the body to the JSON payload. (See code below.)

> **Main.daml**
>
> ```haskell
> module Main where
> 
> import Daml.Script
> 
> type AssetId = ContractId Asset
> 
> template Asset
> with
> issuer : Party
> owner : Party
> name : Text
> where
> ensure name /= ""
> signatory issuer, owner -- added owner
> observer owner
> choice Give : AssetId
> with
> newOwner : Party
> controller owner
> do create this with
> owner = newOwner
> 
> setup : Script AssetId
> setup = script do
> -- user_setup_begin
> alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
> bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
> aliceId <- validateUserId "alice"
> bobId <- validateUserId "bob"
> createUser (User aliceId (Some alice)) [CanActAs alice]
> createUser (User bobId (Some bob)) [CanActAs bob]
> -- user_setup_end
> 
> submitMulti [alice, bob] [alice, bob] do -- modified
> createCmd Asset with
> issuer = alice
> owner = bob
> name = "TV"
> 
> ```

> **JWT payload**
>
> ```haskell
> {
> "https://daml.com/ledger-api": {
> "ledgerId": "sandbox",
> "applicationId": "foobar",
> "actAs": ["Alice::1220da75f38e5e1646005009f38663d6a5f852e340f00b986ca1d3664a1de899ca90","Bob::1220da75f38e5e1646005009f38663d6a5f852e340f00b986ca1d3664a1de899ca90"]
> }
> }
> 
> ```

> **JSON payload**
>
> ```haskell
> {
> "templateId": "3907bff048d6a5f1f7011cdde7cdd32dbd96895533abde443716945373d3a8a2:Main:Asset",
> "contractId": "00e9ba1dd24395ca912a7e604c769a7c1f27d99215649fcd8e7405b71f9435d356ca011220b68a1ab794074167f5c80c432cf06174e45a6e96f25ccbcba66ec1964f932fad",
> "choice": "Archive",
> "argument": {}
> }
> 
> ```

Here is the result on my machine:

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/b/bd7af2cd57759fb1ddd29350ad87270e84c02c1e.png)

Can you think of anything that is different in your case?

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 3, 2023, 2:46am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/5 "2023-02-03T02:46:42Z")

</div>

@WallaceKelly canton  
I upload dar file to canton-enterprise-2.3.4  
and use DAML SDK 2.5.0 start JsonAPI service  
The contract is historical data, not sure about the SDK version that generated the dar file

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 3, 2023, 3:23am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/6 "2023-02-03T03:23:35Z")

</div>

@WallaceKelly  
Another difference is that my two signers are on different participant nodes

---

<div class="post-metadata">

**Author:** ![Mate\_Varga](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mate_varga/32/2308_2.png) [@Mate\_Varga](https://forum.canton.network/u/Mate_Varga)\
**Post date:** [February 3, 2023, 3:59am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/7 "2023-02-03T03:59:32Z")

</div>

I just spotted that the exp field of your token is 1666076941, which is a timestamp that points to October in the last year.

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 3, 2023, 4:23am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/8 "2023-02-03T04:23:50Z")

</div>

I reassembled the token, still the same error

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/b/b26b8fbf63ea8c7b9f0fff04a4d406640c914c95.png)  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/0/0e4d48b48fc6eba5b60d3ef58e008e6535f7b9cd.png)

---

<div class="post-metadata">

**Author:** ![Mate\_Varga](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mate_varga/32/2308_2.png) [@Mate\_Varga](https://forum.canton.network/u/Mate_Varga)\
**Post date:** [February 3, 2023, 4:28am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/9 "2023-02-03T04:28:20Z")

</div>

First you should check the JSON API Server logs if there are more details about it, then the logs produced by your participant node.

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 3, 2023, 4:51am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/10 "2023-02-03T04:51:16Z")

</div>

I found this error message in the log  
Malformed request err-context:{location=TransactionProcessingSteps.scala:281, message=Confirmation request creation failed, reason=ParticipantAuthorizationError(PAR::participant2::12208660a72f… does not host MC::1220782025913f21ae3df5b87f75015329f9b5c1d7f5173f68c6ef54fee330f0ead1 or is not active.)}

HK is participant2‘s party, MC is participant1’s party, HK and MC both the signatories,and I want to Archive the contract by use participant1‘s JsonAPI

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 3, 2023, 5:02am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/11 "2023-02-03T05:02:31Z")

</div>

When I switched to the JsonApIiof participant1 to Archive, this error occurred.

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/0/02be629fbcaf76c032c9be9d57a58b55a97ad2b8.png)

At present, it seems that the contract is signed by two parties on the two participant nodes, but there is no dar file for this contract on participant1 nodes.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [February 3, 2023, 7:49am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/12 "2023-02-03T07:49:09Z")

</div>

> [@skylorna](#):
>
> At present, it seems that the contract is signed by two parties on the two participant nodes, but there is no dar file for this contract on participant1 nodes.

That shouldn’t be possible. How did you verify that the contract has both parties as signatories? You could try uploading the DAR again. Uploading the same DAR multiple times is harmless so that shouldn’t cause any issues.

---

<div class="post-metadata">

**Author:** ![skylorna](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/skylorna/32/6986_2.png) [@skylorna](https://forum.canton.network/u/skylorna)\
**Post date:** [February 3, 2023, 10:04am UTC](https://forum.canton.network/t/a-contract-has-two-signers-i-want-to-archive-the-contract-through-jsonapi-how-should-the-token-be-assembled/6053/13 "2023-02-03T10:04:31Z")

</div>

It may be that participant1 has been artificially deleted. There is no such dar file on participant1 and the contract cannot be found, so it should be an illegal operation that caused this problem. Thank you.
