From e725da1d50986b101097a2d49804e70319210b70 Mon Sep 17 00:00:00 2001 From: "raul@facturapi.io" Date: Mon, 13 Apr 2026 21:34:16 -0600 Subject: [PATCH] chore(defaultSeries): add new default series method --- website/openapi_v2.en.yaml | 129 ++++++++++++++++++++++++++++++++++++- website/openapi_v2.yaml | 129 ++++++++++++++++++++++++++++++++++++- 2 files changed, 256 insertions(+), 2 deletions(-) diff --git a/website/openapi_v2.en.yaml b/website/openapi_v2.en.yaml index 8d017f05c..f51b6e572 100644 --- a/website/openapi_v2.en.yaml +++ b/website/openapi_v2.en.yaml @@ -8028,7 +8028,107 @@ paths: $ref: "#/components/responses/Unauthenticated" "500": $ref: "#/components/responses/UnexpectedError" - + + /organizations/{organization_id}/series-group/default-series: + put: + operationId: updateDefaultSeries + tags: + - organization + summary: Set default series + description: | + Assigns a default series for the specified invoice type. + x-codeSamples: + - lang: Bash + label: cURL + source: | + curl https://www.facturapi.io/v2/organizations/5a2a307be93a2f00129ea035/series-group/default-series \ + -X PUT \ + -H "Authorization: Bearer sk_user_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "type": "I", + "series": "A" + }' + - lang: JavaScript + label: Node.js + source: | + import Facturapi from 'facturapi' + const facturapi = new Facturapi('sk_user_API_KEY'); + + const result = await facturapi.organizations.updateDefaultSeries( + '5a2a307be93a2f00129ea035', + { + type: 'I', + series: 'A' + } + ); + - lang: csharp + label: C# + source: | + var facturapi = new FacturapiClient("sk_user_API_KEY"); + var result = await facturapi.Organization.UpdateDefaultSeriesAsync( + "5a2a307be93a2f00129ea035", + new Dictionary + { + ["type"] = "I", + ["series"] = "A" + } + ); + - lang: Java + label: Java + source: | + import io.facturapi.Facturapi; + import java.util.List; + import java.util.Map; + + Facturapi facturapi = new Facturapi("sk_test_API_KEY"); + + var response = facturapi.organizations().updateDefaultSeries( + "org_123", + Map.of( + "type", "I", + "series", "A" + ) + ); + - lang: PHP + source: | + $facturapi = new Facturapi("sk_user_API_KEY"); + $result = $facturapi->Organizations->updateDefaultSeries( + "5a2a307be93a2f00129ea035", + [ + "type" => "I", + "series" => "A" + ] + ); + requestBody: + $ref: "#/components/requestBodies/OrganizationSeriesDefault" + parameters: + - in: path + name: organization_id + schema: + type: string + required: true + description: Organization ID + security: + - "SecretLiveKey": [] + - "SecretTestKey": [] + - "SecretUserKey": [] + responses: + "200": + description: Default series updated + content: + application/json: + schema: + $ref: "#/components/schemas/OkResponse" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthenticated" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/UnexpectedError" + /organizations/{organization_id}/series-group/{series_name}: put: operationId: updateSeriesGroup @@ -10524,6 +10624,11 @@ components: application/json: schema: $ref: "#/components/schemas/OrganizationSeriesUpdateInput" + OrganizationSeriesDefault: + content: + application/json: + schema: + $ref: "#/components/schemas/OrganizationSeriesDefaultInput" OrganizationInviteCreate: required: true content: @@ -15995,6 +16100,28 @@ components: next_folio_test: type: integer description: Folio number that will be assigned to the next invoice in the Test environment (and will automatically increase with each new invoice). + OrganizationSeriesDefaultInput: + type: object + required: + - type + - series + properties: + type: + type: string + enum: + - I + - E + - P + - N + - T + description: | + Invoice type. Possible values: + `I` (Income), `E` (Expense), `P` (Payment), `N` (Payroll), `T` (Transfer). + series: + type: string + minLength: 1 + maxLength: 25 + description: Series name. OrganizationSeriesGroup: title: Objeto Series type: object diff --git a/website/openapi_v2.yaml b/website/openapi_v2.yaml index 39ad5e3e7..f19e21709 100644 --- a/website/openapi_v2.yaml +++ b/website/openapi_v2.yaml @@ -8222,7 +8222,107 @@ paths: $ref: "#/components/responses/Unauthenticated" "500": $ref: "#/components/responses/UnexpectedError" - + + /organizations/{organization_id}/series-group/default-series: + put: + operationId: updateDefaultSeries + tags: + - organization + summary: Establecer serie predeterminada + description: | + Asigna una serie predeterminada para el tipo de comprobante indicado. + x-codeSamples: + - lang: Bash + label: cURL + source: | + curl https://www.facturapi.io/v2/organizations/5a2a307be93a2f00129ea035/series-group/default-series \ + -X PUT \ + -H "Authorization: Bearer sk_user_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "type": "I", + "series": "A" + }' + - lang: JavaScript + label: Node.js + source: | + import Facturapi from 'facturapi' + const facturapi = new Facturapi('sk_user_API_KEY'); + + const result = await facturapi.organizations.updateDefaultSeries( + '5a2a307be93a2f00129ea035', + { + type: 'I', + series: 'A' + } + ); + - lang: csharp + label: C# + source: | + var facturapi = new FacturapiClient("sk_user_API_KEY"); + var result = await facturapi.Organization.UpdateDefaultSeriesAsync( + "5a2a307be93a2f00129ea035", + new Dictionary + { + ["type"] = "I", + ["series"] = "A" + } + ); + - lang: Java + label: Java + source: | + import io.facturapi.Facturapi; + import java.util.List; + import java.util.Map; + + Facturapi facturapi = new Facturapi("sk_test_API_KEY"); + + var response = facturapi.organizations().updateDefaultSeries( + "org_123", + Map.of( + "type", "I", + "series", "A" + ) + ); + - lang: PHP + source: | + $facturapi = new Facturapi("sk_user_API_KEY"); + $result = $facturapi->Organizations->updateDefaultSeries( + "5a2a307be93a2f00129ea035", + [ + "type" => "I", + "series" => "A" + ] + ); + requestBody: + $ref: "#/components/requestBodies/OrganizationSeriesDefault" + parameters: + - in: path + name: organization_id + schema: + type: string + required: true + description: ID de la organización + security: + - "SecretLiveKey": [] + - "SecretTestKey": [] + - "SecretUserKey": [] + responses: + "200": + description: Serie predeterminada actualizada + content: + application/json: + schema: + $ref: "#/components/schemas/OkResponse" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthenticated" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/UnexpectedError" + /organizations/{organization_id}/series-group/{series_name}: put: operationId: updateSeriesGroup @@ -10709,6 +10809,11 @@ components: application/json: schema: $ref: "#/components/schemas/OrganizationSeriesUpdateInput" + OrganizationSeriesDefault: + content: + application/json: + schema: + $ref: "#/components/schemas/OrganizationSeriesDefaultInput" OrganizationInviteCreate: required: true content: @@ -16205,6 +16310,28 @@ components: next_folio_test: type: integer description: Número de folio que se asignará a la siguiente factura en ambiente Test (y que se incrementará automáticamente por cada nueva factura). + OrganizationSeriesDefaultInput: + type: object + required: + - type + - series + properties: + type: + type: string + enum: + - I + - E + - P + - N + - T + description: | + Tipo de comprobante. Valores posibles: + `I` (Ingreso), `E` (Egreso), `P` (Pago), `N` (Nómina), `T` (Traslado). + series: + type: string + minLength: 1 + maxLength: 25 + description: Nombre de la serie. OrganizationSeriesGroup: title: Objeto Series type: object