> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Create organization

POST https://api-sandbox.payabli.com/api/Organization
Content-Type: application/json

Creates an organization under a parent organization. This is also referred to as a suborganization.

Reference: https://docs.payabli.com/developers/api-reference/organization/create-organization

## Authentication

- `Authorization` header (bearer token, required)
- `requestToken` header (required) — Long-lived API token sent in the `requestToken` header. See [API token authentication](/developers/api-tokens).

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Headers

- `idempotencyKey` (string, optional) — _Optional but recommended_ A unique ID that you can include to prevent duplicating objects or transactions in the case that a request is sent more than once. This key isn't generated in Payabli, you must generate it yourself. This key persists for 2 minutes. After 2 minutes, you can reuse the key if needed.

### Body (application/json)

- `orgName` (string, required) — The name of the organization.
- `orgType` (integer, required) — The organization type. Currently, this must be `0`.
- `replyToEmail` (string, required) — Email address for organization-level communications, such as messages about why an application was declined. This is required by commerce laws in the US.
- `services` (list of object, optional)
  - `description` (string, optional)
  - `enabled` (boolean, optional) — Toggles whether the section or element is enabled.
  - `monthlyCost` (double, optional)
  - `name` (string, optional)
  - `reseller` (boolean, optional)
  - `setupCost` (double, optional)
  - `txCost` (double, optional)
  - `txPercentCost` (double, optional)
- `billingInfo` (object, optional)
  - `achAccount` (string, required) — Bank account number.
  - `achRouting` (string, required) — ABA/routing number of Bank account.
  - `billingAddress` (string, optional) — Billing address.
  - `billingCity` (string, optional) — Billing city.
  - `billingCountry` (string, optional) — Billing address country.
  - `billingState` (string, optional) — Billing state. Must be a 2-letter state code for addresses in the US.
  - `billingZip` (string, optional) — Billing address ZIP code.
- `contacts` (list of object, optional) — List of contacts.
  - `contactEmail` (string, optional) — Contact email address.
  - `contactName` (string, optional) — Contact name.
  - `contactPhone` (string, optional) — Contact phone number.
  - `contactTitle` (string, optional) — Contact title.
  - `additionalData` (string, optional) — Custom dictionary of key:value pairs. You can use this field to store any data related to the object or for your system. Example usage: ```json { "additionalData": { "key1": "value1", "key2": "value2", "key3": "value3" } } ```
- `hasBilling` (boolean, optional)
- `hasResidual` (boolean, optional)
- `orgAddress` (string, optional) — The organization's address.
- `orgCity` (string, optional) — The organization's city.
- `orgCountry` (string, optional) — The organization's country.
- `orgEntryName` (string, optional) — The entryname for the org, in string format. If you leave this blank, Payabli uses the DBA name.
- `orgId` (string, optional) — An alternate ID for the organization, in string format. This can be your internal identifier for an org, and is typically a name, like "My Suborganization".
- `orgLogo` (object, optional) — Contains details about a file. Max upload size is 30 MB.
  - `fContent` (string, optional) — Content of file, Base64-encoded. Ignored if `furl` is specified. Max upload size is 30 MB.
  - `filename` (string, optional) — The name of the attached file.
  - `ftype` (enum, optional) — The MIME type of the file (if content is provided).
    - Allowed values: `pdf`, `doc`, `docx`, `jpg`, `jpeg`, `png`, `gif`, `txt`
  - `furl` (string, optional) — Optional URL provided to show or download the file remotely.
- `orgParentId` (long, optional) — The ID of the org's parent organization.
- `orgState` (string, optional) — The organization's state.
- `orgTimezone` (integer, optional) — The org's timezone, in UTC offset. For example, -5 is Eastern time.
- `orgWebsite` (string, optional) — The organization's website.
- `orgZip` (string, optional) — The organization's ZIP code.

## Response

### 200

Success.

- `responseText` (string, required) — Response text for operation: 'Success' or 'Declined'.
- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `responseData` (string or integer, optional) — Returns the organization ID.

## Examples

**Request**

```json
{
  "orgName": "Pilgrim Planner",
  "orgType": 0,
  "replyToEmail": "email@example.com",
  "billingInfo": {
    "achAccount": "123123123",
    "achRouting": "123123123",
    "billingAddress": "123 Walnut Street",
    "billingCity": "Johnson City",
    "billingCountry": "US",
    "billingState": "TN",
    "billingZip": "37615"
  },
  "contacts": [
    {
      "contactEmail": "herman@hermanscoatings.com",
      "contactName": "Herman Martinez",
      "contactPhone": "3055550000",
      "contactTitle": "Owner"
    }
  ],
  "hasBilling": true,
  "hasResidual": true,
  "orgAddress": "123 Walnut Street",
  "orgCity": "Johnson City",
  "orgCountry": "US",
  "orgEntryName": "pilgrim-planner",
  "orgId": "123",
  "orgLogo": {
    "fContent": "TXkgdGVzdCBmaWxlHJ==...",
    "filename": "my-doc.pdf",
    "ftype": "pdf",
    "furl": "https://mysite.com/my-doc.pdf"
  },
  "orgParentId": 236,
  "orgState": "TN",
  "orgTimezone": -5,
  "orgWebsite": "www.pilgrimageplanner.com",
  "orgZip": "37615"
}
```

**Response**

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "responseData": 245
}
```

**SDK Code**

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET",
    });
    await client.organization.addOrganization({
        idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA",
        billingInfo: {
            achAccount: "123123123",
            achRouting: "123123123",
            billingAddress: "123 Walnut Street",
            billingCity: "Johnson City",
            billingCountry: "US",
            billingState: "TN",
            billingZip: "37615",
        },
        contacts: [
            {
                contactEmail: "herman@hermanscoatings.com",
                contactName: "Herman Martinez",
                contactPhone: "3055550000",
                contactTitle: "Owner",
            },
        ],
        hasBilling: true,
        hasResidual: true,
        orgAddress: "123 Walnut Street",
        orgCity: "Johnson City",
        orgCountry: "US",
        orgEntryName: "pilgrim-planner",
        orgId: "123",
        orgLogo: {
            fContent: "TXkgdGVzdCBmaWxlHJ==...",
            filename: "my-doc.pdf",
            ftype: "pdf",
            furl: "https://mysite.com/my-doc.pdf",
        },
        orgName: "Pilgrim Planner",
        orgParentId: 236,
        orgState: "TN",
        orgTimezone: -5,
        orgType: 0,
        orgWebsite: "www.pilgrimageplanner.com",
        orgZip: "37615",
        replyToEmail: "email@example.com",
    });
}
main();

```

```python
from payabli import payabli, Instrument, Contacts, FileContent

client = payabli(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

client.organization.add_organization(
    idempotency_key="6B29FC40-CA47-1067-B31D-00DD010662DA",
    billing_info=Instrument(
        ach_account="123123123",
        ach_routing="123123123",
        billing_address="123 Walnut Street",
        billing_city="Johnson City",
        billing_country="US",
        billing_state="TN",
        billing_zip="37615",
    ),
    contacts=[
        Contacts(
            contact_email="herman@hermanscoatings.com",
            contact_name="Herman Martinez",
            contact_phone="3055550000",
            contact_title="Owner",
        )
    ],
    has_billing=True,
    has_residual=True,
    org_address="123 Walnut Street",
    org_city="Johnson City",
    org_country="US",
    org_entry_name="pilgrim-planner",
    org_id="123",
    org_logo=FileContent(
        f_content="TXkgdGVzdCBmaWxlHJ==...",
        filename="my-doc.pdf",
        ftype="pdf",
        furl="https://mysite.com/my-doc.pdf",
    ),
    org_name="Pilgrim Planner",
    org_parent_id=236,
    org_state="TN",
    org_timezone=-5,
    org_type=0,
    org_website="www.pilgrimageplanner.com",
    org_zip="37615",
    reply_to_email="email@example.com",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;
import io.github.payabli.api.resources.organization.requests.AddOrganizationRequest;
import io.github.payabli.api.types.Contacts;
import io.github.payabli.api.types.FileContent;
import io.github.payabli.api.types.FileContentFtype;
import io.github.payabli.api.types.Instrument;
import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient.withCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
            .build()
        ;

        client.organization().addOrganization(
            AddOrganizationRequest
                .builder()
                .orgName("Pilgrim Planner")
                .orgType(0)
                .replyToEmail("email@example.com")
                .idempotencyKey("6B29FC40-CA47-1067-B31D-00DD010662DA")
                .billingInfo(
                    Instrument
                        .builder()
                        .achAccount("123123123")
                        .achRouting("123123123")
                        .billingAddress("123 Walnut Street")
                        .billingCity("Johnson City")
                        .billingCountry("US")
                        .billingState("TN")
                        .billingZip("37615")
                        .build()
                )
                .contacts(
                    Arrays.asList(
                        Contacts
                            .builder()
                            .contactEmail("herman@hermanscoatings.com")
                            .contactName("Herman Martinez")
                            .contactPhone("3055550000")
                            .contactTitle("Owner")
                            .build()
                    )
                )
                .hasBilling(true)
                .hasResidual(true)
                .orgAddress("123 Walnut Street")
                .orgCity("Johnson City")
                .orgCountry("US")
                .orgEntryName("pilgrim-planner")
                .orgId("123")
                .orgLogo(
                    FileContent
                        .builder()
                        .fContent("TXkgdGVzdCBmaWxlHJ==...")
                        .filename("my-doc.pdf")
                        .ftype(FileContentFtype.PDF)
                        .furl("https://mysite.com/my-doc.pdf")
                        .build()
                )
                .orgParentId(236L)
                .orgState("TN")
                .orgTimezone(-5)
                .orgWebsite("www.pilgrimageplanner.com")
                .orgZip("37615")
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.organization.add_organization(
  idempotency_key: "6B29FC40-CA47-1067-B31D-00DD010662DA",
  billing_info: {
    ach_account: "123123123",
    ach_routing: "123123123",
    billing_address: "123 Walnut Street",
    billing_city: "Johnson City",
    billing_country: "US",
    billing_state: "TN",
    billing_zip: "37615"
  },
  contacts: [{
    contact_email: "herman@hermanscoatings.com",
    contact_name: "Herman Martinez",
    contact_phone: "3055550000",
    contact_title: "Owner"
  }],
  has_billing: true,
  has_residual: true,
  org_address: "123 Walnut Street",
  org_city: "Johnson City",
  org_country: "US",
  org_entry_name: "pilgrim-planner",
  org_id: "123",
  org_logo: {
    f_content: "TXkgdGVzdCBmaWxlHJ==...",
    filename: "my-doc.pdf",
    ftype: "pdf",
    furl: "https://mysite.com/my-doc.pdf"
  },
  org_name: "Pilgrim Planner",
  org_parent_id: 236,
  org_state: "TN",
  org_timezone: -5,
  org_type: 0,
  org_website: "www.pilgrimageplanner.com",
  org_zip: "37615",
  reply_to_email: "email@example.com"
)

```

```csharp
using PayabliApi;
using System.Threading.Tasks;
using System.Collections.Generic;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient(
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET"
        );

        await client.Organization.AddOrganizationAsync(
            new AddOrganizationRequest {
                IdempotencyKey = "6B29FC40-CA47-1067-B31D-00DD010662DA",
                BillingInfo = new Instrument {
                    AchAccount = "123123123",
                    AchRouting = "123123123",
                    BillingAddress = "123 Walnut Street",
                    BillingCity = "Johnson City",
                    BillingCountry = "US",
                    BillingState = "TN",
                    BillingZip = "37615"
                },
                Contacts = new List<Contacts>(){
                    new Contacts {
                        ContactEmail = "herman@hermanscoatings.com",
                        ContactName = "Herman Martinez",
                        ContactPhone = "3055550000",
                        ContactTitle = "Owner"
                    },
                }
                ,
                HasBilling = true,
                HasResidual = true,
                OrgAddress = "123 Walnut Street",
                OrgCity = "Johnson City",
                OrgCountry = "US",
                OrgEntryName = "pilgrim-planner",
                OrgId = "123",
                OrgLogo = new FileContent {
                    FContent = "TXkgdGVzdCBmaWxlHJ==...",
                    Filename = "my-doc.pdf",
                    Ftype = FileContentFtype.Pdf,
                    Furl = "https://mysite.com/my-doc.pdf"
                },
                OrgName = "Pilgrim Planner",
                OrgParentId = 236L,
                OrgState = "TN",
                OrgTimezone = -5,
                OrgType = 0,
                OrgWebsite = "www.pilgrimageplanner.com",
                OrgZip = "37615",
                ReplyToEmail = "email@example.com"
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithClientCredentials(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
        ),
    )
    request := &payabli.AddOrganizationRequest{
        IdempotencyKey: payabli.String(
            "6B29FC40-CA47-1067-B31D-00DD010662DA",
        ),
        OrgName: "Pilgrim Planner",
        OrgType: 0,
        ReplyToEmail: "email@example.com",
        BillingInfo: &payabli.Instrument{
            AchAccount: "123123123",
            AchRouting: "123123123",
            BillingAddress: payabli.String(
                "123 Walnut Street",
            ),
            BillingCity: payabli.String(
                "Johnson City",
            ),
            BillingCountry: payabli.String(
                "US",
            ),
            BillingState: payabli.String(
                "TN",
            ),
            BillingZip: payabli.String(
                "37615",
            ),
        },
        Contacts: &payabli.ContactsField{
            &payabli.Contacts{
                ContactEmail: payabli.String(
                    "herman@hermanscoatings.com",
                ),
                ContactName: payabli.String(
                    "Herman Martinez",
                ),
                ContactPhone: payabli.String(
                    "3055550000",
                ),
                ContactTitle: payabli.String(
                    "Owner",
                ),
            },
        },
        HasBilling: payabli.Bool(
            true,
        ),
        HasResidual: payabli.Bool(
            true,
        ),
        OrgAddress: payabli.String(
            "123 Walnut Street",
        ),
        OrgCity: payabli.String(
            "Johnson City",
        ),
        OrgCountry: payabli.String(
            "US",
        ),
        OrgEntryName: payabli.String(
            "pilgrim-planner",
        ),
        OrgId: payabli.String(
            "123",
        ),
        OrgLogo: &payabli.FileContent{
            FContent: payabli.String(
                "TXkgdGVzdCBmaWxlHJ==...",
            ),
            Filename: payabli.String(
                "my-doc.pdf",
            ),
            Ftype: payabli.FileContentFtypePdf.Ptr(),
            Furl: payabli.String(
                "https://mysite.com/my-doc.pdf",
            ),
        },
        OrgParentId: payabli.Int64(
            int64(236),
        ),
        OrgState: payabli.String(
            "TN",
        ),
        OrgTimezone: payabli.Int(
            -5,
        ),
        OrgWebsite: payabli.String(
            "www.pilgrimageplanner.com",
        ),
        OrgZip: payabli.String(
            "37615",
        ),
    }
    client.Organization.AddOrganization(
        context.TODO(),
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Organization\Requests\AddOrganizationRequest;
use Payabli\Types\Instrument;
use Payabli\Types\Contacts;
use Payabli\Types\FileContent;
use Payabli\Types\FileContentFtype;

$client = new PayabliClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
);
$client->organization->addOrganization(
    new AddOrganizationRequest([
        'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA',
        'billingInfo' => new Instrument([
            'achAccount' => '123123123',
            'achRouting' => '123123123',
            'billingAddress' => '123 Walnut Street',
            'billingCity' => 'Johnson City',
            'billingCountry' => 'US',
            'billingState' => 'TN',
            'billingZip' => '37615',
        ]),
        'contacts' => [
            new Contacts([
                'contactEmail' => 'herman@hermanscoatings.com',
                'contactName' => 'Herman Martinez',
                'contactPhone' => '3055550000',
                'contactTitle' => 'Owner',
            ]),
        ],
        'hasBilling' => true,
        'hasResidual' => true,
        'orgAddress' => '123 Walnut Street',
        'orgCity' => 'Johnson City',
        'orgCountry' => 'US',
        'orgEntryName' => 'pilgrim-planner',
        'orgId' => '123',
        'orgLogo' => new FileContent([
            'fContent' => 'TXkgdGVzdCBmaWxlHJ==...',
            'filename' => 'my-doc.pdf',
            'ftype' => FileContentFtype::Pdf->value,
            'furl' => 'https://mysite.com/my-doc.pdf',
        ]),
        'orgName' => 'Pilgrim Planner',
        'orgParentId' => 236,
        'orgState' => 'TN',
        'orgTimezone' => -5,
        'orgType' => 0,
        'orgWebsite' => 'www.pilgrimageplanner.com',
        'orgZip' => '37615',
        'replyToEmail' => 'email@example.com',
    ]),
);

```

```swift
import Foundation

let headers = [
  "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "orgName": "Pilgrim Planner",
  "orgType": 0,
  "replyToEmail": "email@example.com",
  "billingInfo": [
    "achAccount": "123123123",
    "achRouting": "123123123",
    "billingAddress": "123 Walnut Street",
    "billingCity": "Johnson City",
    "billingCountry": "US",
    "billingState": "TN",
    "billingZip": "37615"
  ],
  "contacts": [
    [
      "contactEmail": "herman@hermanscoatings.com",
      "contactName": "Herman Martinez",
      "contactPhone": "3055550000",
      "contactTitle": "Owner"
    ]
  ],
  "hasBilling": true,
  "hasResidual": true,
  "orgAddress": "123 Walnut Street",
  "orgCity": "Johnson City",
  "orgCountry": "US",
  "orgEntryName": "pilgrim-planner",
  "orgId": "123",
  "orgLogo": [
    "fContent": "TXkgdGVzdCBmaWxlHJ==...",
    "filename": "my-doc.pdf",
    "ftype": "pdf",
    "furl": "https://mysite.com/my-doc.pdf"
  ],
  "orgParentId": 236,
  "orgState": "TN",
  "orgTimezone": -5,
  "orgWebsite": "www.pilgrimageplanner.com",
  "orgZip": "37615"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Organization")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```