Share account connection

Shares access scopes from the account specified to the caller, establishing a connection between the two accounts with the specified permissions.
POST
/accounts/{accountID}/connections
cURL .NET Java Ruby TypeScript PHP Python
curl -X POST "https://api.moov.io/accounts/{accountID}/connections" \
  -H "Authorization: Bearer {token}" \
  -H "x-moov-version: v2024.01.00" \
  --data-raw '{
    "principalAccountID": "string",
    "allowScopes": [
      "accounts.read"
    ]
  }'\
using Moov.Sdk;
using Moov.Sdk.Models.Components;
using System.Collections.Generic;

var sdk = new MoovClient(xMoovVersion: "<value>");

var res = await sdk.Accounts.ConnectAsync(
    accountID: "456cb5b6-20dc-4585-97b4-745d013adb1f",
    body: new ShareScopes() {
        PrincipalAccountID = "c520f1b9-0ba7-42f5-b977-248cdbe41c69",
        AllowScopes = new List<ApplicationScope>() {
            ApplicationScope.TransfersWrite,
            ApplicationScope.PaymentMethodsRead,
        },
    }
);

// handle response
package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.ConnectAccountRequestValidationError;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.ConnectAccountResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws GenericError, ConnectAccountRequestValidationError, Exception {

        Moov sdk = Moov.builder()
                .xMoovVersion("<value>")
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        ConnectAccountResponse res = sdk.accounts().connect()
                .accountID("456cb5b6-20dc-4585-97b4-745d013adb1f")
                .shareScopes(ShareScopes.builder()
                    .principalAccountID("c520f1b9-0ba7-42f5-b977-248cdbe41c69")
                    .allowScopes(List.of(
                        ApplicationScope.TRANSFERS_WRITE,
                        ApplicationScope.PAYMENT_METHODS_READ))
                    .build())
                .call();

        // handle response
    }
}
require 'moov_ruby'

Models = ::Moov::Models
s = ::Moov::Client.new(
      x_moov_version: '<value>',
    )

res = s.accounts.connect(account_id: '456cb5b6-20dc-4585-97b4-745d013adb1f', share_scopes: Models::Components::ShareScopes.new(
  principal_account_id: 'c520f1b9-0ba7-42f5-b977-248cdbe41c69',
  allow_scopes: [
    Models::Components::ApplicationScope::TRANSFERS_WRITE,
    Models::Components::ApplicationScope::PAYMENT_METHODS_READ,
  ],
))

if res.status_code == 200
  # handle response
end
import { Moov } from "@moovio/sdk";

const moov = new Moov({
  xMoovVersion: "<value>",
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.accounts.connect({
    accountID: "456cb5b6-20dc-4585-97b4-745d013adb1f",
    shareScopes: {
      principalAccountID: "c520f1b9-0ba7-42f5-b977-248cdbe41c69",
      allowScopes: [
        "transfers.write",
        "payment-methods.read",
      ],
    },
  });

  console.log(result);
}

run();
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setXMoovVersion('<value>')
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$shareScopes = new Components\ShareScopes(
    principalAccountID: 'c520f1b9-0ba7-42f5-b977-248cdbe41c69',
    allowScopes: [
        Components\ApplicationScope::TransfersWrite,
        Components\ApplicationScope::PaymentMethodsRead,
    ],
);

$response = $sdk->accounts->connect(
    accountID: '456cb5b6-20dc-4585-97b4-745d013adb1f',
    shareScopes: $shareScopes

);

if ($response->statusCode === 200) {
    // handle response
}
from moovio_sdk import Moov
from moovio_sdk.models import components


with Moov(
    x_moov_version="<value>",
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

    res = moov.accounts.connect(account_id="456cb5b6-20dc-4585-97b4-745d013adb1f", principal_account_id="c520f1b9-0ba7-42f5-b977-248cdbe41c69", allow_scopes=[
        components.ApplicationScope.TRANSFERS_WRITE,
        components.ApplicationScope.PAYMENT_METHODS_READ,
    ])

    # Handle response
    print(res)
201 400 401 403 404 409 422 429 500 504
The resource was successfully created.

x-request-id

string required
A unique identifier used to trace requests.
The server could not understand the request due to invalid syntax.
application/json
{
  "error": "string"
}

x-request-id

string required
A unique identifier used to trace requests.
The request contained missing or expired authentication.

x-request-id

string required
A unique identifier used to trace requests.
The user is not authorized to make the request.

x-request-id

string required
A unique identifier used to trace requests.
The requested resource was not found.

x-request-id

string required
A unique identifier used to trace requests.
The request conflicted with the current state of the target resource.
application/json
{
  "error": "string"
}

x-request-id

string required
A unique identifier used to trace requests.
The request was well-formed, but the contents failed validation. Check the request for missing or invalid fields.
application/json
{
  "principalAccountID": "string",
  "allowScopes": {
    "0": "first element failed validation..."
  }
}

x-request-id

string required
A unique identifier used to trace requests.
Request was refused due to rate limiting.

x-request-id

string required
A unique identifier used to trace requests.
The request failed due to an unexpected error.

x-request-id

string required
A unique identifier used to trace requests.
The request failed because a downstream service failed to respond.

x-request-id

string required
A unique identifier used to trace requests.

Headers

X-Moov-Version

string

Specify an API version.

API versioning follows the format vYYYY.QQ.BB, where

  • YYYY is the year
  • QQ is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
  • BB is the build number, starting at .01, for subsequent builds in the same quarter.
    • For example, v2024.01.00 is the initial release of the first quarter of 2024.

The latest version represents the most recent development state. It may include breaking changes and should be treated as a beta release. When no version is specified, the API defaults to v2024.01.00.

Path parameters

accountID

string required

Body

application/json
Describes the scopes being shared from a subject account to a principal account.

principalAccountID

string required
The account ID that will receive access to the scopes.

allowScopes

array<string>
The list of scopes to share with the principal account. If none are provided, all intersecting scopes are added.
Possible values: accounts.read, accounts.write, analytics.read, apple-pay-merchant.read, apple-pay-merchant.write, apple-pay.read, apple-pay.write, bank-accounts.read, bank-accounts.write, capabilities.read, capabilities.write, cards.read, cards.write, documents.read, documents.write, fed.read, files.read, files.write, issued-cards.read, issued-cards.write, issued-cards.read-secure, payment-methods.read, ping.read, profile-enrichment.read, profile.read, profile.write, profile.disconnect, representatives.read, representatives.write, transfers.read, transfers.write, wallets.read