Update your organization
Route
PUT
/api/v1/organizations
Usage
- Curl
- Python
- Ruby
- Javascript
- Go
- C#
- PHP
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request PUT "$LAGO_URL/api/v1/organizations" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"organization": {
"name": "Name1",
"webhook_url": "https://test-example.example",
"country": "CZ",
"address_line1": "address1",
"address_line2": null,
"state": "state1",
"zipcode": "10000",
"email": "org@email.com",
"city": "city125",
"legal_name": null,
"legal_number": null,
"tax_identification_number": "EU123456789",
"timezone": "Europe/Paris",
"email_settings": [
"invoice.finalized",
"credit_note.created"
],
"billing_configuration": {
"invoice_footer": "footer custom",
"invoice_grace_period": 3,
"document_locale": "fr",
"vat_rate": 15.0
}
}
}'
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
from lago_python_client.models import Organization, OrganizationBillingConfiguration
client = Client(api_key='__YOUR_API_KEY__')
params = Organization(
timezone="Europe/Paris",
webhook_url="https://new.url",
email_settings=["invoice.finalized"],
tax_identification_number="EU123456789",
billing_configuration=OrganizationBillingConfiguration(
invoice_footer="footer custom",
invoice_grace_period=3,
document_locale="fr",
vat_rate=12.5
)
)
try:
client.organizations.update(params)
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new({api_key: '__YOUR_API_KEY__'})
update_params = {
timezone: 'Europe/Paris',
webhook_url: 'https://webhook_url.com',
email_settings: ['invoice.finalized'],
tax_identification_number: "EU123456789",
billing_configuration: {
invoice_footer="footer custom",
invoice_grace_period=3,
document_locale: "fr",
vat_rate: 10
}
}
client.organizations.update(update_params)
await client.organizations.updateOrganization({
organization: {
timezone: "Europe/Paris",
webhookUrl: "https://newwebhookurl.com",
emailSettings: ["invoice.finalized"],
taxIdentificationNumber: "EU123456789",
billingConfiguration: {
invoiceFooter: "footer custom",
invoiceGracePeriod: 3,
documentLocale: "fr",
vatRate: 15.5,
},
},
});
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
organizationInput := &lago.OrganizationInput{
LegalName: "Legal Name",
Timezone: "Europe/Paris",
EmailSettings: ["invoice.finalized"],
TaxIdentificationNumber: "EU123456789",
BillingConfiguration: &OrganizationBillingConfigurationInput{
InvoiceFooter: "footer custom",
InvoiceGracePeriod: 3,
DocumentLocale: "fr",
VatRate: 20.0,
}
}
organization, err := lagoClient.Organization().Update(organizationInput)
if err != nil {
// Error is *lago.Error
panic(err)
}
// organization is *lago.Organization
fmt.Println(organization)
}
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class UpdateOrganizationExample
{
public static void Main()
{
Configuration.Default.BasePath = "https://api.getlago.com/api/v1";
// Configure HTTP bearer authorization: bearerAuth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrganizationsApi(Configuration.Default);
var organizationInput = new OrganizationInput(); // OrganizationInput | Update an existing organization
try
{
// Update an existing Organization
Organization result = apiInstance.UpdateOrganization(organizationInput);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrganizationsApi.UpdateOrganization: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\OrganizationsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$organization_input = new \OpenAPI\Client\Model\OrganizationInput(); // \OpenAPI\Client\Model\OrganizationInput | Update an existing organization
try {
$result = $apiInstance->updateOrganization($organization_input);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling OrganizationsApi->updateOrganization: ', $e->getMessage(), PHP_EOL;
}
Arguments
{
"organization": {
"webhook_url": "https://test-example.example",
"country": "CZ",
"address_line1": "address1",
"address_line2": null,
"state": "state1",
"zipcode": "10000",
"email": "org@email.com",
"city": "city125",
"legal_name": null,
"legal_number": null,
"tax_identification_number": "EU123456789",
"timezone": "Europe/Paris",
"email_settings": ["invoice.finalized", "credit_note.created"],
"billing_configuration": {
"invoice_footer": "footer custom",
"invoice_grace_period": 3,
"document_locale": "fr",
"vat_rate": 15.0
}
}
}
Attributes | Type | Description |
---|---|---|
webhook_url | String Optional | Webhook URL |
country | String Optional ISO 3166 (alpha-2) | Country where the organization is located |
address_line1 | String Optional | Address (first line) |
address_line2 | String Optional | Address (second line) |
state | String Optional | State where the organization is located |
zipcode | String Optional | Zip code associated with the organization's address |
String Optional | Business email address | |
city | String Optional | City where the organization is located |
legal_name | String Optional | Legal name of the organization |
legal_number | String Optional | Legal number of the organization |
tax_identification_number | String Optional | Tax identification number of the organization |
timezone | String Optional TZ database | Timezone of the organization - learn more UTC by default |
email_settings | Array Optional Possible values are invoice.finalized and credit_note.created | Email settings of the organization |
billing_configuration | Object Optional | Custom billing settings |
Billing configuration
Attributes | Type | Description |
---|---|---|
invoice_footer | String Optional | Custom invoice footer |
invoice_grace_period | Integer Optional | Grace period (in days) |
document_locale | String Optional | Document locale in ISO 639-1 format - learn more |
vat_rate | Float Optional | Custom VAT rate |
Responses
- HTTP 200
- HTTP 400
- HTTP 401
- HTTP 422
The organization was successfully updated
Returns an organization object.
{
"status": 400,
"error": "Bad Request"
}
The organization
json root is not present in the request body.
{
"status": 401,
"error": "Unauthorized"
}
Access to the API endpoint is unhautorized.
Possible reasons are:
- The
Authorization
header is missing - The
Authorization
header does not contain the API key - The Api key is invalid or expired
{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {
"field": ["error"]
}
}
Possible errors:
field | error | description |
---|---|---|
webhook_url | url_is_invalid | bebhook_url format is invalid |
vat_rate | value_is_out_of_range | vat_rate is not between 0 and 100 |
country | not_a_valid_country_code | Provided country is invalid |
invoice_footer | value_is_too_long | Footer length is too long |
invoice_grace_period | value_is_out_of_range | Provided invoice grace period is invalid. It must be a positive integer |
email | invalid_email_format | Email format is invalid |
logo | invalid_size | File size is too big |
logo | invalid_content_type | Content type is invalid |
timezone | timezone_invalid | Provided timezone is invalid |
email_settings | unsupported_value | One of the Email Settings is invalid |