openapi: 3.0.3 info: title: Common REST API description: |- ## Common API This is a set of common API useful to interact with the core information of the A-Cube API sets. ## Authentication To obtain a JWT token send a `POST https://common.api.acubeapi.com/login` (or `POST https://common-sandbox.api.acubeapi.com/login` in case you are working on the sandbox environment) specifying the HTTP header `Content-Type: application/json` with the following payload ``` { "email": "your@email.com", "password": "your password" } ``` If the login went fine you will receive a response with ``` { "token": "a very long encrypted token" } ``` The token you receive is a JWT token that lasts 24 hours. **You can ask a JWT token once every 24 hours**. The token is composed by 3 parts, each part is delimited by a dot (`.`) char. Exploding the token by `.` and doing a base64 decode of the second part you will obtain some useful informtion. Example ``` {"iat":,"exp":,"roles":{"": ["ROLE_WRITER"]},"username":,"uid":} ``` The field `` is the production domain of the API set you have access. I.e. peppol.api.acubeapi.com or it.api.acubeapi.com To use the token you must set it as Bearer into the **Authorization** header. Example: ``` curl -X GET \ https://common-sandbox.api.acubeapi.com/users/me \ -H 'Accept: application/json' \ -H 'Authorization: Bearer ' \ ``` version: 1.0.0 servers: - url: / description: '' paths: /consumptions: get: operationId: getConsumptionCollection tags: - Consumption responses: '200': description: Consumption collection content: application/ld+json: schema: type: object properties: hydra:member: type: array items: $ref: '#/components/schemas/Consumption.ConsumptionOutput.jsonld' hydra:totalItems: type: integer minimum: 0 hydra:view: type: object properties: '@id': type: string format: iri-reference '@type': type: string hydra:first: type: string format: iri-reference hydra:last: type: string format: iri-reference hydra:previous: type: string format: iri-reference hydra:next: type: string format: iri-reference hydra:search: type: object properties: '@type': type: string hydra:template: type: string hydra:variableRepresentation: type: string hydra:mapping: type: array items: type: object properties: '@type': type: string variable: type: string property: type: string nullable: true required: type: boolean required: - hydra:member application/json: schema: type: array items: $ref: '#/components/schemas/Consumption.ConsumptionOutput' text/html: schema: type: array items: $ref: '#/components/schemas/Consumption.ConsumptionOutput' summary: Retrieves the collection of Consumption resources. description: Get the list of consumptions by year and month that are not included in a pre-sale package. parameters: - name: page in: query description: The collection page number required: false deprecated: false allowEmptyValue: true schema: type: integer default: 1 style: form explode: false allowReserved: false - name: year in: query description: '' required: false deprecated: false allowEmptyValue: true schema: type: integer style: form explode: false allowReserved: false - name: year[] in: query description: '' required: false deprecated: false allowEmptyValue: true schema: type: array items: type: integer style: form explode: true allowReserved: false - name: month in: query description: '' required: false deprecated: false allowEmptyValue: true schema: type: integer style: form explode: false allowReserved: false - name: month[] in: query description: '' required: false deprecated: false allowEmptyValue: true schema: type: array items: type: integer style: form explode: true allowReserved: false deprecated: false parameters: [] /consumptions/{uuid}: get: operationId: getConsumptionItem tags: - Consumption responses: '200': description: Consumption resource content: application/ld+json: schema: $ref: '#/components/schemas/Consumption.ConsumptionOutput.jsonld' application/json: schema: $ref: '#/components/schemas/Consumption.ConsumptionOutput' text/html: schema: $ref: '#/components/schemas/Consumption.ConsumptionOutput' '404': description: Resource not found summary: Retrieves a Consumption resource. description: Retrieves a Consumption resource. parameters: - name: uuid in: path description: '' required: true deprecated: false allowEmptyValue: false schema: type: string style: simple explode: false allowReserved: false deprecated: false parameters: [] /pre-sale-actions: get: operationId: getPreSaleActionCollection tags: - PreSaleAction responses: '200': description: PreSaleAction collection content: application/ld+json: schema: type: object properties: hydra:member: type: array items: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput.jsonld' hydra:totalItems: type: integer minimum: 0 hydra:view: type: object properties: '@id': type: string format: iri-reference '@type': type: string hydra:first: type: string format: iri-reference hydra:last: type: string format: iri-reference hydra:previous: type: string format: iri-reference hydra:next: type: string format: iri-reference hydra:search: type: object properties: '@type': type: string hydra:template: type: string hydra:variableRepresentation: type: string hydra:mapping: type: array items: type: object properties: '@type': type: string variable: type: string property: type: string nullable: true required: type: boolean required: - hydra:member application/json: schema: type: array items: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' text/html: schema: type: array items: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' summary: Retrieves the collection of PreSaleAction resources. description: Get the list of the presale actions and their current status parameters: - name: page in: query description: The collection page number required: false deprecated: false allowEmptyValue: true schema: type: integer default: 1 style: form explode: false allowReserved: false deprecated: false post: operationId: postPreSaleActionCollection tags: - PreSaleAction responses: '201': description: PreSaleAction resource created content: application/ld+json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput.jsonld' application/json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' text/html: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' links: GetPreSaleActionItem: operationId: getPreSaleActionItem parameters: uuid: $response.body#/uuid description: The `uuid` value returned in the response can be used as the `uuid` parameter in `GET /pre-sale-actions/{uuid}`. '400': description: Invalid input '422': description: Unprocessable entity summary: Creates a new PreSaleAction resource. description: Create a new presale action parameters: [] requestBody: description: The new PreSaleAction resource content: application/ld+json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionInput.jsonld' application/json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionInput' text/html: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionInput' required: true deprecated: false parameters: [] /pre-sale-actions/{uuid}: get: operationId: getPreSaleActionItem tags: - PreSaleAction responses: '200': description: PreSaleAction resource content: application/ld+json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput.jsonld' application/json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' text/html: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' '404': description: Resource not found summary: Retrieves a PreSaleAction resource. description: Retrieves a PreSaleAction resource. parameters: - name: uuid in: path description: '' required: true deprecated: false allowEmptyValue: false schema: type: string style: simple explode: false allowReserved: false deprecated: false put: operationId: putPreSaleActionItem tags: - PreSaleAction responses: '200': description: PreSaleAction resource updated content: application/ld+json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput.jsonld' application/json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' text/html: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionOutput' links: GetPreSaleActionItem: operationId: getPreSaleActionItem parameters: uuid: $response.body#/uuid description: The `uuid` value returned in the response can be used as the `uuid` parameter in `GET /pre-sale-actions/{uuid}`. '400': description: Invalid input '404': description: Resource not found '422': description: Unprocessable entity summary: Updates a PreSaleAction resource. description: Replaces the PreSaleAction resource. parameters: - name: uuid in: path description: '' required: true deprecated: false allowEmptyValue: false schema: type: string style: simple explode: false allowReserved: false requestBody: description: The updated PreSaleAction resource content: application/ld+json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionInput.jsonld' application/json: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionInput' text/html: schema: $ref: '#/components/schemas/PreSaleAction.PreSaleActionInput' required: true deprecated: false delete: operationId: deletePreSaleActionItem tags: - PreSaleAction responses: '204': description: PreSaleAction resource deleted '404': description: Resource not found summary: Deletes a PreSaleAction resource. description: Removes the PreSaleAction resource. parameters: - name: uuid in: path description: '' required: true deprecated: false allowEmptyValue: false schema: type: string style: simple explode: false allowReserved: false deprecated: false parameters: [] /pre-sales: get: operationId: getPreSaleCollection tags: - PreSale responses: '200': description: PreSale collection content: application/ld+json: schema: type: object properties: hydra:member: type: array items: $ref: '#/components/schemas/PreSale.PreSaleOutput.jsonld' hydra:totalItems: type: integer minimum: 0 hydra:view: type: object properties: '@id': type: string format: iri-reference '@type': type: string hydra:first: type: string format: iri-reference hydra:last: type: string format: iri-reference hydra:previous: type: string format: iri-reference hydra:next: type: string format: iri-reference hydra:search: type: object properties: '@type': type: string hydra:template: type: string hydra:variableRepresentation: type: string hydra:mapping: type: array items: type: object properties: '@type': type: string variable: type: string property: type: string nullable: true required: type: boolean required: - hydra:member application/json: schema: type: array items: $ref: '#/components/schemas/PreSale.PreSaleOutput' text/html: schema: type: array items: $ref: '#/components/schemas/PreSale.PreSaleOutput' summary: Retrieves the collection of PreSale resources. description: Get the list of bought presale packages and their current status parameters: - name: page in: query description: The collection page number required: false deprecated: false allowEmptyValue: true schema: type: integer default: 1 style: form explode: false allowReserved: false deprecated: false parameters: [] /pre-sales/{uuid}: get: operationId: getPreSaleItem tags: - PreSale responses: '200': description: PreSale resource content: application/ld+json: schema: $ref: '#/components/schemas/PreSale.PreSaleOutput.jsonld' application/json: schema: $ref: '#/components/schemas/PreSale.PreSaleOutput' text/html: schema: $ref: '#/components/schemas/PreSale.PreSaleOutput' '404': description: Resource not found summary: Retrieves a PreSale resource. description: Retrieves a PreSale resource. parameters: - name: uuid in: path description: '' required: true deprecated: false allowEmptyValue: false schema: type: string style: simple explode: false allowReserved: false deprecated: false parameters: [] /users/{id}: get: operationId: getUserItem tags: - User responses: '200': description: User resource content: application/ld+json: schema: $ref: '#/components/schemas/User.UserOutput.jsonld' application/json: schema: $ref: '#/components/schemas/User.UserOutput' text/html: schema: $ref: '#/components/schemas/User.UserOutput' '404': description: Resource not found summary: Get user profile. description: Retrieves a User resource. parameters: - name: id in: path description: '' required: true deprecated: false allowEmptyValue: false schema: enum: - me style: simple explode: false allowReserved: false deprecated: false put: operationId: putUserItem tags: - User responses: '200': description: User resource updated content: application/ld+json: schema: $ref: '#/components/schemas/User.UserOutput.jsonld' application/json: schema: $ref: '#/components/schemas/User.UserOutput' text/html: schema: $ref: '#/components/schemas/User.UserOutput' links: GetUserItem: operationId: getUserItem parameters: id: $response.body#/id description: The `id` value returned in the response can be used as the `id` parameter in `GET /users/{id}`. '400': description: Invalid input '404': description: Resource not found '422': description: Unprocessable entity summary: Update user profile. description: Replaces the User resource. parameters: - name: id in: path description: '' required: true deprecated: false allowEmptyValue: false schema: enum: - me style: simple explode: false allowReserved: false requestBody: description: The updated User resource content: application/ld+json: schema: $ref: '#/components/schemas/User.UserInput.jsonld' application/json: schema: $ref: '#/components/schemas/User.UserInput' text/html: schema: $ref: '#/components/schemas/User.UserInput' required: true deprecated: false parameters: [] /users/{id}/change-password: put: operationId: change_passwordUserItem tags: - User responses: '200': description: User resource updated content: application/ld+json: schema: $ref: '#/components/schemas/User.UserOutput.jsonld' application/json: schema: $ref: '#/components/schemas/User.UserOutput' text/html: schema: $ref: '#/components/schemas/User.UserOutput' links: GetUserItem: operationId: getUserItem parameters: id: $response.body#/id description: The `id` value returned in the response can be used as the `id` parameter in `GET /users/{id}`. '400': description: Invalid input '404': description: Resource not found '422': description: Unprocessable entity summary: Update user password. description: Replaces the User resource. parameters: - name: id in: path description: '' required: true deprecated: false allowEmptyValue: false schema: enum: - me style: simple explode: false allowReserved: false requestBody: description: The updated User resource content: application/ld+json: schema: $ref: '#/components/schemas/User.UserPassword.jsonld' application/json: schema: $ref: '#/components/schemas/User.UserPassword' text/html: schema: $ref: '#/components/schemas/User.UserPassword' required: true deprecated: false parameters: [] components: schemas: Consumption.ConsumptionOutput: type: object description: '' properties: uuid: type: string month: type: integer year: type: integer total: type: string invoices_sent: type: integer invoices_received: type: integer Consumption.ConsumptionOutput.jsonld: type: object description: '' properties: '@id': readOnly: true type: string '@type': readOnly: true type: string '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true uuid: type: string month: type: integer year: type: integer total: type: string invoices_sent: type: integer invoices_received: type: integer PreSale.PreSaleOutput: type: object description: '' properties: uuid: type: string created_at: type: string valid_until: type: string total_credit_purchased: type: string current_credit_available: type: string current_credit_purchased: type: string invoices_sent: type: integer invoices_received: type: integer PreSale.PreSaleOutput.jsonld: type: object description: '' properties: '@id': readOnly: true type: string '@type': readOnly: true type: string '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true uuid: type: string created_at: type: string valid_until: type: string total_credit_purchased: type: string current_credit_available: type: string current_credit_purchased: type: string invoices_sent: type: integer invoices_received: type: integer PreSaleAction.PreSaleActionInput: type: object description: '' required: - threshold - action_type - target - enabled - pre_sale_uuid properties: threshold: description: The value under which the PreSaleAction is triggered. type: integer action_type: enum: - alert_mail description: What kind of action to trigger, currently only alert_mail is supported. type: string target: oneOf: - format: email description: The target used by the action, e.g. in case of alert_email the target must be the email address that will receive the message. type: string enabled: type: boolean pre_sale_uuid: type: string PreSaleAction.PreSaleActionInput.jsonld: type: object description: '' required: - threshold - action_type - target - enabled - pre_sale_uuid properties: '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true '@id': readOnly: true type: string '@type': readOnly: true type: string threshold: description: The value under which the PreSaleAction is triggered. type: integer action_type: enum: - alert_mail description: What kind of action to trigger, currently only alert_mail is supported. type: string target: oneOf: - format: email description: The target used by the action, e.g. in case of alert_email the target must be the email address that will receive the message. type: string enabled: type: boolean pre_sale_uuid: type: string PreSaleAction.PreSaleActionOutput: type: object description: '' properties: uuid: type: string created_at: type: string updated_at: type: string threshold: description: The value under which the PreSaleAction is triggered. type: integer action_type: enum: - alert_mail description: What kind of action to trigger, currently only alert_mail is supported. type: string target: description: The target used by the action, e.g. in case of alert_email the target must be the email address that will receive the message. type: string enabled: type: boolean running: description: True this PreSaleAction is currently running on our platform. type: boolean pre_sale_uuid: type: string PreSaleAction.PreSaleActionOutput.jsonld: type: object description: '' properties: '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true '@id': readOnly: true type: string '@type': readOnly: true type: string uuid: type: string created_at: type: string updated_at: type: string threshold: description: The value under which the PreSaleAction is triggered. type: integer action_type: enum: - alert_mail description: What kind of action to trigger, currently only alert_mail is supported. type: string target: description: The target used by the action, e.g. in case of alert_email the target must be the email address that will receive the message. type: string enabled: type: boolean running: description: True this PreSaleAction is currently running on our platform. type: boolean pre_sale_uuid: type: string User.UserInput: type: object description: '' properties: fullname: type: string nullable: true invoicing_vat_number: type: string nullable: true invoicing_fiscal_id: type: string nullable: true invoicing_address: type: string nullable: true invoicing_city: type: string nullable: true invoicing_province: type: string nullable: true invoicing_cap: type: string nullable: true invoicing_name: type: string nullable: true invoicing_country: type: string nullable: true invoicing_sdi_recipient_code: type: string nullable: true invoicing_sdi_pec: type: string nullable: true User.UserInput.jsonld: type: object description: '' properties: '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true '@id': readOnly: true type: string '@type': readOnly: true type: string fullname: type: string nullable: true invoicing_vat_number: type: string nullable: true invoicing_fiscal_id: type: string nullable: true invoicing_address: type: string nullable: true invoicing_city: type: string nullable: true invoicing_province: type: string nullable: true invoicing_cap: type: string nullable: true invoicing_name: type: string nullable: true invoicing_country: type: string nullable: true invoicing_sdi_recipient_code: type: string nullable: true invoicing_sdi_pec: type: string nullable: true User.UserOutput: type: object description: '' properties: email: type: string fullname: type: string nullable: true invoicing_vat_number: type: string nullable: true invoicing_fiscal_id: type: string nullable: true invoicing_address: type: string nullable: true invoicing_city: type: string nullable: true invoicing_province: type: string nullable: true invoicing_cap: type: string nullable: true invoicing_name: type: string nullable: true invoicing_country: type: string nullable: true invoicing_sdi_recipient_code: type: string nullable: true invoicing_sdi_pec: type: string nullable: true User.UserOutput.jsonld: type: object description: '' properties: '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true '@id': readOnly: true type: string '@type': readOnly: true type: string email: type: string fullname: type: string nullable: true invoicing_vat_number: type: string nullable: true invoicing_fiscal_id: type: string nullable: true invoicing_address: type: string nullable: true invoicing_city: type: string nullable: true invoicing_province: type: string nullable: true invoicing_cap: type: string nullable: true invoicing_name: type: string nullable: true invoicing_country: type: string nullable: true invoicing_sdi_recipient_code: type: string nullable: true invoicing_sdi_pec: type: string nullable: true User.UserPassword: type: object description: '' required: - password properties: password: pattern: ^((?=.*[A-z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,}).*)$ type: string User.UserPassword.jsonld: type: object description: '' required: - password properties: '@context': readOnly: true oneOf: - type: string - type: object properties: '@vocab': type: string hydra: type: string enum: - http://www.w3.org/ns/hydra/core# required: - '@vocab' - hydra additionalProperties: true '@id': readOnly: true type: string '@type': readOnly: true type: string password: pattern: ^((?=.*[A-z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,}).*)$ type: string responses: {} parameters: {} examples: {} requestBodies: {} headers: {} securitySchemes: apiKey: type: apiKey description: Value for the Authorization header parameter. name: Authorization in: header security: - apiKey: [] tags: []