Managing Subaccounts

Use our API to easily handle subaccounts: create, delete, retrieve information, and transfer balance. Ideal for those who want to manage their account structure clearly and efficiently.


GET/api/subaccounts?action=read

List Subaccounts

Request a list of all subaccounts of an account.

Parameters

  • Name
    id
    Type
    integer
    Optional
    Optional
    Description

    The ID of a subaccount. This will give you only the data for a specific subaccount.

Request

GET
/api/subaccounts
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

[
  {
      "id": "1234567891",
      "username": null,
      "company": "Company 1",
      "balance": "36.8100",
      "total_usage": "0.3000",
      "auto_topup": {
          "threshold": "1",
          "amount": "5"
      },
      "contact": {
          "name": "John Doe",
          "email": "sms@acme-company1.com"
      }
  },
  {
      "id": "1234567892",
      "username": "push2app",
      "company": "Another Company",
      "balance": "120.4000",
      "total_usage": "0.0000",
      "auto_topup": {
          "threshold": null,
          "amount": null
      },
      "contact": {
          "name": "Donald Dummy",
          "email": "contact@another-acme-company.com"
      }
  },
  {
    "id": 12345
    // ...
  }
]

GET/api/subaccounts?action=create

Create Subaccount

Create a subaccount via the API.

Parameters

  • Name
    name
    Type
    string
    Description

    Full first and last name of the account owner.

  • Name
    email
    Type
    string
    Description

    Email address of the account.

Request

GET
/api/subaccounts?action=create
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "name=John Doe" \
  -d "email=john.doe@acme-inc.com"

Successful Response

{
  "success": true,
  "error": null,
  "subaccount": {
      "id": "123456789",
      "username": null,
      "company": null,
      "balance": 0,
      "total_usage": 0,
      "auto_topup": {
          "threshold": 0,
          "amount": 0
      },
      "contact": {
          "name": "John Doe",
          "email": "john.doe@acme-inc.com"
      }
  }
}

Error Response

{
  "success": false,
  "error": "Invalid request"
}

GET/api/subaccounts?action=update

Automatic Balance Transfer

With this API, you can configure the automatic credit transfer for a subaccount. This can transfer credit from the main account to the subaccount when a set threshold is reached. To deactivate, simply set amount to 0.

Parameters

  • Name
    id
    Type
    integer
    Description

    The ID of the subaccount.

  • Name
    threshold
    Type
    float
    Description

    The credit threshold, below which credit should be transferred.

  • Name
    amount
    Type
    float
    Description

    The amount of credit that should be sent from the main account to the subaccount when threshold is reached.

Request

GET
/api/subaccounts?action=update
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "id=49176123456789" \
  -d "threshold=100.0" \
  -d "amount=200.0"

Successful Response

{
  "success": true,
  "error": null
}

GET/api/subaccounts?action=transfer_credits

Manual Credit Transfer

With this API, you can transfer credit from the main account to the subaccount once.

Parameters

  • Name
    id
    Type
    integer
    Description

    ID of the subaccount.

  • Name
    amount
    Type
    float
    Description

    Credit to be transferred.

Request

GET
/api/subaccounts?action=transfer_credits
curl -G https://gateway.seven.io/api/subaccounts?action=transfer_credits \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "id=123456789" \
  -d "amount=250.0"

Response

{
  "success": true,
  "error": null
}

GET/api/subaccounts?action=delete

Deleting Subaccounts

With this API, subaccounts can be deleted based on their ID.

Parameters

  • Name
    id
    Type
    integer
    Description

    ID of the subaccount.

request

GET
/api/subaccounts?action=delete
curl -G https://gateway.seven.io/api/subaccounts?action=delete \
-H "X-Api-Key: YOUR_API_KEY" \
-d "id=123456789"

Response

{
        "success": true,
        "error": null
    }
Last updated: 6 months ago