# 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 ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Add organization version: endpoint_organization.AddOrganization paths: /Organization: post: operationId: add-organization summary: Add organization description: >- Creates an organization under a parent organization. This is also referred to as a suborganization. tags: - - subpackage_organization parameters: - name: requestToken in: header required: true schema: type: string - name: idempotencyKey in: header required: false schema: $ref: '#/components/schemas/type_:IdempotencyKey' responses: '200': description: Success. content: application/json: schema: $ref: '#/components/schemas/type_organization:AddOrganizationResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: type: object properties: services: type: array items: $ref: '#/components/schemas/type_:ServiceCost' billingInfo: $ref: '#/components/schemas/type_:Instrument' contacts: $ref: '#/components/schemas/type_:ContactsField' hasBilling: type: boolean hasResidual: type: boolean orgAddress: $ref: '#/components/schemas/type_:Orgaddress' orgCity: $ref: '#/components/schemas/type_:Orgcity' orgCountry: $ref: '#/components/schemas/type_:Orgcountry' orgEntryName: $ref: '#/components/schemas/type_:Orgentryname' orgId: $ref: '#/components/schemas/type_:Orgidstring' orgLogo: $ref: '#/components/schemas/type_:FileContent' orgName: $ref: '#/components/schemas/type_:Orgname' orgParentId: $ref: '#/components/schemas/type_:OrgParentId' orgState: $ref: '#/components/schemas/type_:Orgstate' orgTimezone: $ref: '#/components/schemas/type_:Orgtimezone' orgType: $ref: '#/components/schemas/type_:Orgtype' orgWebsite: $ref: '#/components/schemas/type_:Orgwebsite' orgZip: $ref: '#/components/schemas/type_:Orgzip' replyToEmail: $ref: '#/components/schemas/type_:ReplyToEmail' required: - orgName - orgType - replyToEmail components: schemas: type_:IdempotencyKey: type: string type_:Enabled: type: boolean type_:ServiceCost: type: object properties: description: type: string enabled: $ref: '#/components/schemas/type_:Enabled' monthlyCost: type: number format: double name: type: string reseller: type: boolean setupCost: type: number format: double txCost: type: number format: double txPercentCost: type: number format: double type_:Achaccount: type: string type_:Achrouting: type: string type_:BillingAddressNullable: type: string type_:BillingCityNullable: type: string type_:BillingCountryNullable: type: string type_:BillingStateNullable: type: string type_:BillingZip: type: string type_:Instrument: type: object properties: achAccount: $ref: '#/components/schemas/type_:Achaccount' achRouting: $ref: '#/components/schemas/type_:Achrouting' billingAddress: $ref: '#/components/schemas/type_:BillingAddressNullable' billingCity: $ref: '#/components/schemas/type_:BillingCityNullable' billingCountry: $ref: '#/components/schemas/type_:BillingCountryNullable' billingState: $ref: '#/components/schemas/type_:BillingStateNullable' billingZip: $ref: '#/components/schemas/type_:BillingZip' required: - achAccount - achRouting type_:Email: type: string format: email type_:AdditionalDataString: type: string type_:Contacts: type: object properties: contactEmail: $ref: '#/components/schemas/type_:Email' description: Contact email address. contactName: type: string description: Contact name. contactPhone: type: string description: Contact phone number. contactTitle: type: string description: Contact title. additionalData: $ref: '#/components/schemas/type_:AdditionalDataString' type_:ContactsField: type: array items: $ref: '#/components/schemas/type_:Contacts' type_:Orgaddress: type: string type_:Orgcity: type: string type_:Orgcountry: type: string type_:Orgentryname: type: string type_:Orgidstring: type: string type_:FileContentFtype: type: string enum: - value: pdf - value: doc - value: docx - value: jpg - value: jpeg - value: png - value: gif - value: txt type_:FileContent: type: object properties: fContent: type: string description: >- Content of file, Base64-encoded. Ignored if furl is specified. Max upload size is 30 MB. filename: type: string description: The name of the attached file. ftype: $ref: '#/components/schemas/type_:FileContentFtype' description: The MIME type of the file (if content is provided) furl: type: string description: Optional URL provided to show or download the file remotely type_:Orgname: type: string type_:OrgParentId: type: integer format: int64 type_:Orgstate: type: string type_:Orgtimezone: type: integer type_:Orgtype: type: integer type_:Orgwebsite: type: string type_:Orgzip: type: string type_:ReplyToEmail: type: string format: email type_:IsSuccess: type: boolean type_:Responsedatanonobject: oneOf: - type: string - type: integer type_:ResponseText: type: string type_organization:AddOrganizationResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseData: $ref: '#/components/schemas/type_:Responsedatanonobject' description: Returns the organization ID. responseText: $ref: '#/components/schemas/type_:ResponseText' required: - responseText ``` ## SDK Code Examples ```python General success response for certain organization operations from payabli import Contacts, FileContent, Instrument, payabli client = payabli( api_key="YOUR_API_KEY", ) 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", ) ``` ```typescript General success response for certain organization operations import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); 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" }); ``` ```go General success response for certain organization operations import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.Organization.AddOrganization( context.TODO(), &sdkgo.AddOrganizationRequest{ IdempotencyKey: sdkgo.String( "6B29FC40-CA47-1067-B31D-00DD010662DA", ), BillingInfo: &sdkgo.Instrument{ AchAccount: "123123123", AchRouting: "123123123", BillingAddress: sdkgo.String( "123 Walnut Street", ), BillingCity: sdkgo.String( "Johnson City", ), BillingCountry: sdkgo.String( "US", ), BillingState: sdkgo.String( "TN", ), BillingZip: sdkgo.String( "37615", ), }, Contacts: []*sdkgo.Contacts{ &sdkgo.Contacts{ ContactEmail: sdkgo.String( "herman@hermanscoatings.com", ), ContactName: sdkgo.String( "Herman Martinez", ), ContactPhone: sdkgo.String( "3055550000", ), ContactTitle: sdkgo.String( "Owner", ), }, }, HasBilling: sdkgo.Bool( true, ), HasResidual: sdkgo.Bool( true, ), OrgAddress: sdkgo.String( "123 Walnut Street", ), OrgCity: sdkgo.String( "Johnson City", ), OrgCountry: sdkgo.String( "US", ), OrgEntryName: sdkgo.String( "pilgrim-planner", ), OrgId: sdkgo.String( "123", ), OrgLogo: &sdkgo.FileContent{ FContent: sdkgo.String( "TXkgdGVzdCBmaWxlHJ==...", ), Filename: sdkgo.String( "my-doc.pdf", ), Ftype: sdkgo.FileContentFtypePdf, Furl: sdkgo.String( "https://mysite.com/my-doc.pdf", ), }, OrgName: "Pilgrim Planner", OrgParentId: sdkgo.Int64( 236, ), OrgState: sdkgo.String( "TN", ), OrgTimezone: sdkgo.Int( -5, ), OrgType: 0, OrgWebsite: sdkgo.String( "www.pilgrimageplanner.com", ), OrgZip: sdkgo.String( "37615", ), ReplyToEmail: "email@example.com", }, ) ``` ```csharp General success response for certain organization operations using PayabliApi; var client = new PayabliApiClient("API_KEY"); 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() { 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 = 236, OrgState = "TN", OrgTimezone = -5, OrgType = 0, OrgWebsite = "www.pilgrimageplanner.com", OrgZip = "37615", ReplyToEmail = "email@example.com", } ); ``` ```ruby General success response for certain organization operations require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Organization") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["idempotencyKey"] = '6B29FC40-CA47-1067-B31D-00DD010662DA' request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"orgName\": \"Pilgrim Planner\",\n \"orgType\": 0,\n \"replyToEmail\": \"email@example.com\",\n \"billingInfo\": {\n \"achAccount\": \"123123123\",\n \"achRouting\": \"123123123\",\n \"billingAddress\": \"123 Walnut Street\",\n \"billingCity\": \"Johnson City\",\n \"billingCountry\": \"US\",\n \"billingState\": \"TN\",\n \"billingZip\": \"37615\"\n },\n \"contacts\": [\n {\n \"contactEmail\": \"herman@hermanscoatings.com\",\n \"contactName\": \"Herman Martinez\",\n \"contactPhone\": \"3055550000\",\n \"contactTitle\": \"Owner\"\n }\n ],\n \"hasBilling\": true,\n \"hasResidual\": true,\n \"orgAddress\": \"123 Walnut Street\",\n \"orgCity\": \"Johnson City\",\n \"orgCountry\": \"US\",\n \"orgEntryName\": \"pilgrim-planner\",\n \"orgId\": \"123\",\n \"orgLogo\": {\n \"fContent\": \"TXkgdGVzdCBmaWxlHJ==...\",\n \"filename\": \"my-doc.pdf\",\n \"ftype\": \"pdf\",\n \"furl\": \"https://mysite.com/my-doc.pdf\"\n },\n \"orgParentId\": 236,\n \"orgState\": \"TN\",\n \"orgTimezone\": -5,\n \"orgWebsite\": \"www.pilgrimageplanner.com\",\n \"orgZip\": \"37615\"\n}" response = http.request(request) puts response.read_body ``` ```java General success response for certain organization operations HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/Organization") .header("idempotencyKey", "6B29FC40-CA47-1067-B31D-00DD010662DA") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"orgName\": \"Pilgrim Planner\",\n \"orgType\": 0,\n \"replyToEmail\": \"email@example.com\",\n \"billingInfo\": {\n \"achAccount\": \"123123123\",\n \"achRouting\": \"123123123\",\n \"billingAddress\": \"123 Walnut Street\",\n \"billingCity\": \"Johnson City\",\n \"billingCountry\": \"US\",\n \"billingState\": \"TN\",\n \"billingZip\": \"37615\"\n },\n \"contacts\": [\n {\n \"contactEmail\": \"herman@hermanscoatings.com\",\n \"contactName\": \"Herman Martinez\",\n \"contactPhone\": \"3055550000\",\n \"contactTitle\": \"Owner\"\n }\n ],\n \"hasBilling\": true,\n \"hasResidual\": true,\n \"orgAddress\": \"123 Walnut Street\",\n \"orgCity\": \"Johnson City\",\n \"orgCountry\": \"US\",\n \"orgEntryName\": \"pilgrim-planner\",\n \"orgId\": \"123\",\n \"orgLogo\": {\n \"fContent\": \"TXkgdGVzdCBmaWxlHJ==...\",\n \"filename\": \"my-doc.pdf\",\n \"ftype\": \"pdf\",\n \"furl\": \"https://mysite.com/my-doc.pdf\"\n },\n \"orgParentId\": 236,\n \"orgState\": \"TN\",\n \"orgTimezone\": -5,\n \"orgWebsite\": \"www.pilgrimageplanner.com\",\n \"orgZip\": \"37615\"\n}") .asString(); ``` ```php General success response for certain organization operations request('POST', 'https://api-sandbox.payabli.com/api/Organization', [ 'body' => '{ "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" }', 'headers' => [ 'Content-Type' => 'application/json', 'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift General success response for certain organization operations import Foundation let headers = [ "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA", "requestToken": "", "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() ```