sohansp | Posts: 9

Create Package in multiple sub accounts using API KEY

0 votes

I have access to three Sub Account.
I can create package inside any of the sub accounts in UI.


If i create a package through API it will be created inside my home sub account

How to create package in different sub account using API for a particular user as sender


Duo_Liang | Posts: 3776

Reply to: Create Package in multiple sub accounts using API KEY

1 votes

Hi Sohan,

 

I think this question is right about time! Because in OneSpan Sign's latest release 11.45 (release note here), it introduced a new account role's permission named "Manage users’ transactions, templates, layouts (API)"

11-15-1

Fow now, Admin role won't carry this permission by default, hence you might want to:
(1) Create a customized role with all the necessary permissions + this one and assign the role to you.

(2) Get your API Keys in each of these three subaccounts. The most straightforward way is through the sender UI > Admin menu > API Access, or if your account has sufficient permissions (User Management, Sub Account Management and Api Access), you can retrieve your own API Keys via this call:

GET /api/account/subaccountApiKeys

(3) In order to create transactions in different subaccounts for a particular user as sender, use the corresponding API Key for this subaccount as the authentication, and add "sender" node to the request payload, I will use a standard package creation API for example:

HTTP Request

POST /api/packages

HTTP Headers

Authorization: Basic api_key / Bearer access_token
Accept: application/json
Content-Type: multipart/form-data

Request Payload

{
  "roles": [
    {
      "id": "Role1",
      "signers": [
        {
          "email": "[email protected]",
          "firstName": "1.firstname",
          "lastName": "1.lastname",
          "company": "OneSpan Sign"
        }
      ]
    }
  ],
  "documents": [
    {
      "approvals": [
        {
          "role": "Role1",
          "fields": [
            {
              "page": 0,
              "top": 100,
              "subtype": "FULLNAME",
              "height": 50,
              "left": 100,
              "width": 200,
              "type": "SIGNATURE"
            }
          ]
        }
      ],
      "name": "Test Document"
    }
  ],
  "name": "Example Package",
  "language": "en",
  "description": "New Package",
  "status": "SENT",
  "sender": {
    "email": "sender's email"
  }

}

(4) Sender with this permission will have API Access to view and edit other sender's packages, as long as you've obtained the package ID:
GET/PUT /api/packages/{packageId}

(5)Similarly, in order to bulk retrieve other senders' packages, you'd use the corresponding API Key for this subaccount as the authentication, and use an additional parameter "ownerEmail/ownerUserId" in the package retrieval API:
GET /api/[email protected]&from=1&to=100

 

Duo


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off