Documentación de la API de Cuéntica
La referencia completa de la API REST de Cuéntica: todos los recursos, sus parámetros y ejemplos de código para integrar la facturación y la contabilidad de tu negocio en tus propias aplicaciones y herramientas. Incluida en todas las cuentas, con entorno sandbox para probar sin riesgo.
Introducción
Bienvenido a la documentación de la API de Cuéntica, el software de facturación y contabilidad para autónomos y pymes en España.
Puedes usar la API para acceder a todas las funcionalidades del sistema, pensadas para facilitar el control y la gestión contable y fiscal de los autónomos y pequeñas empresas: emitir facturas, registrar gastos e ingresos, gestionar clientes y proveedores, adjuntar documentos y controlar cobros, pagos y traspasos.
| Dato clave | Valor |
|---|---|
| URL base | https://api.cuentica.com |
| Protocolo | API REST sobre HTTPS, con JSON como formato de entrada y salida |
| Autenticación | Token por usuario y empresa en la cabecera X-AUTH-TOKEN |
| Disponibilidad | Incluida en todas las cuentas y planes, sin coste adicional |
| Entorno de pruebas | Empresas sandbox disponibles para todas las cuentas |
| Límite de peticiones | 600 cada 5 minutos y 7.200 al día |
| Guía de configuración | Cómo crear una empresa sandbox y tokens de acceso |
La API usa la arquitectura REST, que nos permite ofrecer el servicio de una manera estándar, comprensible y con URL’s orientadas a recursos. Usamos las funcionalidades que nos ofrece HTTP (Autenticación HTTP, verbos para expresar las acciones y códigos de respuesta) y como formato de respuesta usamos JSON por ser uno de los más extendidos y de mejor lectura.
Primeros pasos
# Comprueba que tu token funciona pidiendo los datos de la empresa
curl https://api.cuentica.com/company \
-H "X-AUTH-TOKEN: TU_TOKEN"
Para empezar a usar la API solo necesitas una cuenta de Cuéntica. No hace falta activar nada ni contratar ningún plan adicional. Si no tienes cuenta, crea una prueba gratuita de 15 días: no hace falta método de pago y la API y el sandbox están disponibles desde el principio.
- Entra en la configuración de la API. En Cuéntica, despliega el menú de usuario y elige la opción API. Verás todas las empresas de las que eres propietario.
- Crea una empresa sandbox. Pulsa Crear una empresa sandbox. Se creará una copia de tu empresa, con sus clientes y proveedores, para que desarrolles y pruebes tu integración sin alterar los datos reales.
- Genera un token de acceso. En la empresa sandbox, pulsa Añadir nuevo token y elige si tendrá permisos de solo lectura o de lectura y escritura. Puedes regenerarlo, editarlo o eliminarlo en cualquier momento.
- Haz tu primera petición. Envía el token en la cabecera
X-AUTH-TOKENahttps://api.cuentica.com. La petición del ejemplo devuelve los datos de la empresa enJSON. - Pasa a producción. Cuando la integración esté lista, crea un token en tu empresa real y cámbialo en tu aplicación.
Tienes el paso a paso con capturas en la guía cómo crear una empresa sandbox y tokens de acceso.
Autenticación
Para autenticarte con nuestra API necesitas enviarnos el token como parte de la cabecera de las peticiones.
Los tokens se crean desde el menú de usuario de Cuéntica, en la opción API. Cada token puede tener permisos de solo lectura o de lectura y escritura, y puede regenerarse, editarse o eliminarse en cualquier momento. Consulta la guía cómo crear una empresa sandbox y tokens de acceso para más información.
La asignación del token es por usuario y por empresa, por lo que una aplicación cliente puede tener permisos para acceder sólo a una de las empresas de un usuario y no al resto. Las empresas sandbox tienen sus propios tokens, independientes de los de la empresa real.
Limite de peticiones
El limite de peticiones que aceptamos son:
- 600 peticiones cada 5 minutos.
- 7200 peticiones al día.
Este limite puede ser cambiado en el futuro, pero en todo caso mantendremos un limite que permita hacer un uso responsable del API y que se ajuste a los casos de uso de los usuarios.
Headers de la respuesta:
| Nombre | Descripción |
|---|---|
| X-RateLimit-Limit | Numero de petición actual. |
| X-RateLimit-Remaining | Peticiones restantes para el bloque actual. |
| X-RateLimit-Reset | Fecha y hora de fin de este bloque de peticiones (Formato epoch). |
| X-RateLimit-Daily-Limit | Numero diario de peticiones. |
| X-RateLimit-Daily-Remaining | Peticiones restantes en el día |
| X-RateLimit-Daily-Reset | Fecha y hora de siguiente día (Formato epoch). |
Paginación
El limite máximo de items que se pueden devolver en una consulta es 300.
Las rutas que aceptan paginación son:
- get /invoice
- get /expense
- get /provider
- get /customer
Headers de la respuesta:
| Nombre | Descripción |
|---|---|
| X-Pagination-CurrentPage | Pagina que se ha recibido |
| X-Pagination-PageSize | Numero de elementos por página |
| X-Pagination-TotalElements | Elementos totales del recurso que se esta pidiendo, despues de aplicar filtros si los hubiera |
Preguntas frecuentes
- ¿La API de Cuéntica tiene coste o está limitada a algún plan?
- No. La API REST de Cuéntica está incluida en todas las cuentas y en todos los planes, sin coste adicional, también durante el período de prueba gratuito.
- ¿Puedo usar la API si mi cuenta está en trial (el período de prueba inicial de 15 días)?
- Sí. Durante los 15 días de prueba gratuita, que no requiere método de pago, la API está disponible igual que en una cuenta de pago: puedes crear empresas sandbox, generar tokens de acceso y desarrollar tu integración desde el primer momento. Si al terminar la prueba contratas un plan, todo lo que hayas configurado sigue funcionando.
- ¿Puedo probar la API sin tocar los datos reales de mi negocio?
- Sí. Todas las cuentas pueden crear empresas de prueba (sandbox) con sus propios tokens de acceso. La empresa sandbox se crea a partir de la original, copiando sus clientes y proveedores, para desarrollar y probar integraciones de forma fiable y segura sin alterar los datos reales de la empresa.
- ¿Cómo consigo un token de acceso a la API?
- Desde el menú de usuario de Cuéntica, en la opción API, aparecen todas las empresas de las que eres propietario. Para cada una puedes crear tokens con permisos de solo lectura o de lectura y escritura, regenerarlos, editarlos o eliminarlos. Los tokens son por usuario y por empresa, y se envían en cada petición en la cabecera HTTP X-AUTH-TOKEN.
- ¿Qué formato y protocolo usa la API?
- Es una API REST sobre HTTPS con URL base https://api.cuentica.com. Usa los verbos HTTP habituales (GET, POST, PUT y DELETE), códigos de respuesta estándar y JSON como formato de entrada y salida.
- ¿Qué límite de peticiones tiene la API?
- 600 peticiones cada 5 minutos y 7.200 peticiones al día. Cada respuesta incluye las cabeceras X-RateLimit-Limit, X-RateLimit-Remaining y X-RateLimit-Reset, y sus equivalentes diarias. Si se supera el límite, la API responde con el código 429.
- ¿Las facturas emitidas por la API cumplen con Verifactu y TicketBAI?
- Sí. Las facturas creadas a través de la API se registran con la misma configuración de Verifactu o TicketBAI que tenga la empresa en Cuéntica. El campo register_info de cada factura indica el sistema de registro, su estado, la URL de verificación y el código QR.
- ¿Puedo conectar Cuéntica con otras herramientas sin programar?
- Sí. Cuéntica no tiene conectores propios con herramientas concretas, pero su API permite usar plataformas de automatización como Zapier, Make o n8n, y desde ellas conectar Cuéntica con otras herramientas como Stripe, Shopify, WooCommerce o Google Drive sin escribir código.
Empresa
/company
curl --request GET \
--url https://api.cuentica.com/company
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/company")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/company")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/company",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/company")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/company');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/company"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
/company/serie
curl --request GET \
--url https://api.cuentica.com/company/serie
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/company/serie")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/company/serie")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/company/serie",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/company/serie")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/company/serie');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/company/serie"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Cuenta
/account
curl --request GET \
--url https://api.cuentica.com/account
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/account")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/account",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/account")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/account');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/account"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
/account/:id
id pasado como parámetro.
curl --request GET \
--url https://api.cuentica.com/account/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/account/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/account/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/account/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/account/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/account/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/account/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Proveedor
/provider
curl --request GET \
--url https://api.cuentica.com/provider
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/provider")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/provider",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/provider")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/provider');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/provider"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
q |
Devolverá los elementos que contengan el texto en cualquiera de los siguientes campos: razón social, dirección, cif, teléfono e email. |
curl --request POST \
--url https://api.cuentica.com/provider \
--data '{"default_retention":0,"default_expense_type":"600"}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"default_retention\":0,\"default_expense_type\":\"600\"}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"default_retention\":0,\"default_expense_type\":\"600\"}"
conn.request("POST", "/provider", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/provider",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"default_retention\":0,\"default_expense_type\":\"600\"}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/provider")
.body("{\"default_retention\":0,\"default_expense_type\":\"600\"}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/provider');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"default_retention":0,"default_expense_type":"600"}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/provider"
payload := strings.NewReader("{\"default_retention\":0,\"default_expense_type\":\"600\"}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
address string |
Dirección de la empresa, calle, número, piso… |
town string |
Población. |
postal_code string |
Código postal. |
tradename string |
Nombre comercial. Si el campo business_type es individual y este campo no se envía se autogenerará. |
business_name string |
Razón social. Obligatorio si el campo business_type no es individual. |
name string |
Obligatorio si el campo business_type es individual. |
surname_1 string |
Obligatorio si el campo business_type es individual. |
business_type string |
Valores aceptados: individual, company, othersDetalle: individual -> Persona física, freelance…company -> Sociedad (SL, SA, SC, SLL, SLU)others -> Comunidad de bienes, instituciones… |
region string |
Valores aceptados si el país es España Detalle:Provincia. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
tax_id string |
Identificación única de la empresa, si ya existe una empresa con este número no podrá realizarse el registro. Si la empresa es extracomunitaria, se permite que el campo esté vacío, pero el parámetro deberá enviarse siempre. |
surname_2 string |
Usado si el campo business_type es individual. |
country_code string |
Código del país en formato ISO 3166-1 (dos letras) Por defecto ES |
default_payment_method string |
Valores aceptados: cash, receipt, wire_transfer, card, promissory_note, otherDetalle:Este es el método de pago por defecto asociado a esta empresa. Se usará en caso de no enviar un valor en las operaciones relacionadas con esta empresa. |
fax string |
Número de fax. |
phone string |
Número de teléfono. |
web string |
Url de la empresa. |
email string |
Correo electrónico. |
contact_person string |
Persona de contacto. |
personal_comment string |
Comentario personal. |
tax_id_type string |
Valores aceptados: nif, vat_id, passport, country_document, residence_certificate, other, not_registered, unidentifiedDetalle:Si no se envía, se configurará el valor por defecto según el país de residencia. Indica el tipo de identificación fiscal en el país de residencia: - nif: NIF (valor por defecto para españoles)- vat_id: NIF IVA (valor por defecto para intracomunitarios)- passport: Pasaporte- country_document: Documento de identificación del país- residence_certificate: Certificado de residencia- other: Otro (valor por defecto para extracomunitarios si se envía tax_id)- not_registered: No censado- unidentified: Sin identificar (valor por defecto para extracomunitarios si no se envía tax_id) |
default_retention number |
IRPF por defecto que se aplicará a las operaciones con el proveedor |
default_expense_type string |
Valores aceptados |
/provider/:id
curl --request GET \
--url https://api.cuentica.com/provider/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/provider/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/provider/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/provider/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/provider/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/provider/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/provider/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request PUT \
--url https://api.cuentica.com/provider/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/provider/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/provider/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/provider/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/provider/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/provider/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/provider/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
address string |
Dirección de la empresa, calle, número, piso… |
town string |
Población. |
postal_code string |
Código postal. |
tradename string |
Nombre comercial. Si el campo business_type es individual y este campo no se envía se autogenerará. |
business_name string |
Razón social. Obligatorio si el campo business_type no es individual. |
name string |
Obligatorio si el campo business_type es individual. |
surname_1 string |
Obligatorio si el campo business_type es individual. |
business_type string |
Valores aceptados: individual, company, othersDetalle: individual -> Persona física, freelance…company -> Sociedad (SL, SA, SC, SLL, SLU)others -> Comunidad de bienes, instituciones… |
region string |
Valores aceptados si el país es España Detalle:Provincia. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
tax_id string |
Identificación única de la empresa, si ya existe una empresa con este número no podrá realizarse el registro. Si la empresa es extracomunitaria, se permite que el campo esté vacío, pero el parámetro deberá enviarse siempre. |
surname_2 string |
Usado si el campo business_type es individual. |
country_code string |
Código del país en formato ISO 3166-1 (dos letras) Por defecto ES |
default_payment_method string |
Valores aceptados: cash, receipt, wire_transfer, card, promissory_note, otherDetalle:Este es el método de pago por defecto asociado a esta empresa. Se usará en caso de no enviar un valor en las operaciones relacionadas con esta empresa. |
fax string |
Número de fax. |
phone string |
Número de teléfono. |
web string |
Url de la empresa. |
email string |
Correo electrónico. |
contact_person string |
Persona de contacto. |
personal_comment string |
Comentario personal. |
tax_id_type string |
Valores aceptados: nif, vat_id, passport, country_document, residence_certificate, other, not_registered, unidentifiedDetalle:Si no se envía, se configurará el valor por defecto según el país de residencia. Indica el tipo de identificación fiscal en el país de residencia: - nif: NIF (valor por defecto para españoles)- vat_id: NIF IVA (valor por defecto para intracomunitarios)- passport: Pasaporte- country_document: Documento de identificación del país- residence_certificate: Certificado de residencia- other: Otro (valor por defecto para extracomunitarios si se envía tax_id)- not_registered: No censado- unidentified: Sin identificar (valor por defecto para extracomunitarios si no se envía tax_id) |
default_retention number |
IRPF por defecto que se aplicará a las operaciones con el proveedor |
default_expense_type string |
Valores aceptados |
curl --request DELETE \
--url https://api.cuentica.com/provider/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/provider/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/provider/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/provider/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/provider/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/provider/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/provider/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
Cliente
/customer
curl --request GET \
--url https://api.cuentica.com/customer
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/customer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/customer")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/customer",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/customer")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/customer');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/customer"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
q |
Devolverá los elementos que contengan el texto en cualquiera de los siguientes campos: razón social, dirección, cif, teléfono e email. |
curl --request POST \
--url https://api.cuentica.com/customer \
--data '{"default_invoice_language":"default","has_surcharge":false}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/customer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"default_invoice_language\":\"default\",\"has_surcharge\":false}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"default_invoice_language\":\"default\",\"has_surcharge\":false}"
conn.request("POST", "/customer", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/customer",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"default_invoice_language\":\"default\",\"has_surcharge\":false}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/customer")
.body("{\"default_invoice_language\":\"default\",\"has_surcharge\":false}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/customer');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"default_invoice_language":"default","has_surcharge":false}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/customer"
payload := strings.NewReader("{\"default_invoice_language\":\"default\",\"has_surcharge\":false}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
address string |
Dirección de la empresa, calle, número, piso… |
town string |
Población. |
postal_code string |
Código postal. |
tradename string |
Nombre comercial. Si el campo business_type es individual y este campo no se envía se autogenerará. |
business_name string |
Razón social. Obligatorio si el campo business_type no es individual. |
name string |
Obligatorio si el campo business_type es individual. |
surname_1 string |
Obligatorio si el campo business_type es individual. |
business_type string |
Valores aceptados: individual, company, othersDetalle: individual -> Persona física, freelance…company -> Sociedad (SL, SA, SC, SLL, SLU)others -> Comunidad de bienes, instituciones… |
region string |
Valores aceptados si el país es España Detalle:Provincia. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
tax_id string |
Identificación única de la empresa, si ya existe una empresa con este número no podrá realizarse el registro. Si la empresa es extracomunitaria, se permite que el campo esté vacío, pero el parámetro deberá enviarse siempre. |
surname_2 string |
Usado si el campo business_type es individual. |
country_code string |
Código del país en formato ISO 3166-1 (dos letras) Por defecto ES |
default_payment_method string |
Valores aceptados: cash, receipt, wire_transfer, card, promissory_note, otherDetalle:Este es el método de pago por defecto asociado a esta empresa. Se usará en caso de no enviar un valor en las operaciones relacionadas con esta empresa. |
fax string |
Número de fax. |
phone string |
Número de teléfono. |
web string |
Url de la empresa. |
email string |
Correo electrónico. |
contact_person string |
Persona de contacto. |
personal_comment string |
Comentario personal. |
tax_id_type string |
Valores aceptados: nif, vat_id, passport, country_document, residence_certificate, other, not_registered, unidentifiedDetalle:Si no se envía, se configurará el valor por defecto según el país de residencia. Indica el tipo de identificación fiscal en el país de residencia: - nif: NIF (valor por defecto para españoles)- vat_id: NIF IVA (valor por defecto para intracomunitarios)- passport: Pasaporte- country_document: Documento de identificación del país- residence_certificate: Certificado de residencia- other: Otro (valor por defecto para extracomunitarios si se envía tax_id)- not_registered: No censado- unidentified: Sin identificar (valor por defecto para extracomunitarios si no se envía tax_id) |
default_invoice_language string |
Valores aceptados: default, es, eu, ca, enDetalle:Idioma por defecto que se usará en las facturas que se emitan a este cliente, y que no reciban el campo invoice_language.default -> Valor por defecto de la empresaes -> Españoleu -> Euskeraca -> Catalanen -> Inglés |
has_surcharge boolean |
Define si las facturas del cliente van a tener recargo de equivalencia por defecto. |
/customer/:id
curl --request GET \
--url https://api.cuentica.com/customer/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/customer/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/customer/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/customer/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/customer/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/customer/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/customer/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request PUT \
--url https://api.cuentica.com/customer/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/customer/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/customer/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/customer/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/customer/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/customer/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/customer/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
address string |
Dirección de la empresa, calle, número, piso… |
town string |
Población. |
postal_code string |
Código postal. |
tradename string |
Nombre comercial. Si el campo business_type es individual y este campo no se envía se autogenerará. |
business_name string |
Razón social. Obligatorio si el campo business_type no es individual. |
name string |
Obligatorio si el campo business_type es individual. |
surname_1 string |
Obligatorio si el campo business_type es individual. |
business_type string |
Valores aceptados: individual, company, othersDetalle: individual -> Persona física, freelance…company -> Sociedad (SL, SA, SC, SLL, SLU)others -> Comunidad de bienes, instituciones… |
region string |
Valores aceptados si el país es España Detalle:Provincia. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
tax_id string |
Identificación única de la empresa, si ya existe una empresa con este número no podrá realizarse el registro. Si la empresa es extracomunitaria, se permite que el campo esté vacío, pero el parámetro deberá enviarse siempre. |
surname_2 string |
Usado si el campo business_type es individual. |
country_code string |
Código del país en formato ISO 3166-1 (dos letras) Por defecto ES |
default_payment_method string |
Valores aceptados: cash, receipt, wire_transfer, card, promissory_note, otherDetalle:Este es el método de pago por defecto asociado a esta empresa. Se usará en caso de no enviar un valor en las operaciones relacionadas con esta empresa. |
fax string |
Número de fax. |
phone string |
Número de teléfono. |
web string |
Url de la empresa. |
email string |
Correo electrónico. |
contact_person string |
Persona de contacto. |
personal_comment string |
Comentario personal. |
tax_id_type string |
Valores aceptados: nif, vat_id, passport, country_document, residence_certificate, other, not_registered, unidentifiedDetalle:Si no se envía, se configurará el valor por defecto según el país de residencia. Indica el tipo de identificación fiscal en el país de residencia: - nif: NIF (valor por defecto para españoles)- vat_id: NIF IVA (valor por defecto para intracomunitarios)- passport: Pasaporte- country_document: Documento de identificación del país- residence_certificate: Certificado de residencia- other: Otro (valor por defecto para extracomunitarios si se envía tax_id)- not_registered: No censado- unidentified: Sin identificar (valor por defecto para extracomunitarios si no se envía tax_id) |
default_invoice_language string |
Valores aceptados: default, es, eu, ca, enDetalle:Idioma por defecto que se usará en las facturas que se emitan a este cliente, y que no reciban el campo invoice_language.default -> Valor por defecto de la empresaes -> Españoleu -> Euskeraca -> Catalanen -> Inglés |
has_surcharge boolean |
Define si las facturas del cliente van a tener recargo de equivalencia por defecto. |
curl --request DELETE \
--url https://api.cuentica.com/customer/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/customer/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/customer/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/customer/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/customer/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/customer/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/customer/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
Factura
/invoice
curl --request GET \
--url https://api.cuentica.com/invoice
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/invoice")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/invoice")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
customer |
Id del cliente. |
min_total_limit |
Los elementos del listado tendrán un total superior a esta cantidad. |
max_total_limit |
Los elementos tendrán un total inferior a esta cantidad. |
initial_date |
Los elementos tendrán una fecha superior a esta. Con formato yyyy-MM-dd. |
end_date |
Los elementos tendrán una fecha inferior a esta. Con formato yyyy-MM-dd. |
serie |
Devolverá las facturas pertenecientes a dicha serie de facturación. El valor de este parametro es el name que se recibe al llamar a /company/serie |
description |
Devolverá las facturas que contenga parte de la descripción. |
issued |
true -> factura emitidafalse -> borrador |
sort |
Es una lista con los valores por los que se quiere ordenar, con el formato: sort=key:order,key:order,key:order Las key válidas son:* customer -> Ordenar alfabéticamente por cliente. * description -> Ordenar alfabéticamente por descripción. * total_base -> Ordenar por total de la base de la factura. * total_invoice -> Ordenar por total de factura. * number -> Ordenar por número. * date -> Ordenar por fecha. Los order válidos son:* desc -> Mayor a menor. * asc -> Menor a mayor. |
tags |
Lista de tags por los que se quiere buscar: tag_1,tag_2 Se devolverán lso resultados que contengan Todos los tags |
curl --request POST \
--url https://api.cuentica.com/invoice \
--data '{"currency_info":{"currency":"EUR"},"description":"<ADD STRING VALUE>","annotations":"<ADD STRING VALUE>","date":"<ADD STRING VALUE>","serie":"<ADD STRING VALUE>","rectified_id":0,"rectification_key":"R1","rectification_cause":"<ADD STRING VALUE>","tags":["<ADD STRING VALUE>"],"issued":false,"number":0,"customer":0,"footer":"Configuración del usuario.","irm":"Configuración del usuario.","invoice_lines":[{"quantity":0,"concept":"<ADD STRING VALUE>","amount":0,"discount":0,"tax":0,"surcharge":0,"retention":0,"sell_type":"service","tax_regime":"01","tax_subjection_code":"S1"}],"charges":[{"date":"<ADD STRING VALUE>","amount":0,"payment_method":"cash","origin_account":"<ADD STRING VALUE>","destination_account":0,"paid":false}]}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"currency_info\":{\"currency\":\"EUR\"},\"description\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"date\":\"<ADD STRING VALUE>\",\"serie\":\"<ADD STRING VALUE>\",\"rectified_id\":0,\"rectification_key\":\"R1\",\"rectification_cause\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"issued\":false,\"number\":0,\"customer\":0,\"footer\":\"Configuración del usuario.\",\"irm\":\"Configuración del usuario.\",\"invoice_lines\":[{\"quantity\":0,\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"discount\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"sell_type\":\"service\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"currency_info\":{\"currency\":\"EUR\"},\"description\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"date\":\"<ADD STRING VALUE>\",\"serie\":\"<ADD STRING VALUE>\",\"rectified_id\":0,\"rectification_key\":\"R1\",\"rectification_cause\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"issued\":false,\"number\":0,\"customer\":0,\"footer\":\"Configuración del usuario.\",\"irm\":\"Configuración del usuario.\",\"invoice_lines\":[{\"quantity\":0,\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"discount\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"sell_type\":\"service\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}"
conn.request("POST", "/invoice", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"currency_info\":{\"currency\":\"EUR\"},\"description\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"date\":\"<ADD STRING VALUE>\",\"serie\":\"<ADD STRING VALUE>\",\"rectified_id\":0,\"rectification_key\":\"R1\",\"rectification_cause\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"issued\":false,\"number\":0,\"customer\":0,\"footer\":\"Configuración del usuario.\",\"irm\":\"Configuración del usuario.\",\"invoice_lines\":[{\"quantity\":0,\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"discount\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"sell_type\":\"service\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/invoice")
.body("{\"currency_info\":{\"currency\":\"EUR\"},\"description\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"date\":\"<ADD STRING VALUE>\",\"serie\":\"<ADD STRING VALUE>\",\"rectified_id\":0,\"rectification_key\":\"R1\",\"rectification_cause\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"issued\":false,\"number\":0,\"customer\":0,\"footer\":\"Configuración del usuario.\",\"irm\":\"Configuración del usuario.\",\"invoice_lines\":[{\"quantity\":0,\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"discount\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"sell_type\":\"service\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"currency_info":{"currency":"EUR"},"description":"<ADD STRING VALUE>","annotations":"<ADD STRING VALUE>","date":"<ADD STRING VALUE>","serie":"<ADD STRING VALUE>","rectified_id":0,"rectification_key":"R1","rectification_cause":"<ADD STRING VALUE>","tags":["<ADD STRING VALUE>"],"issued":false,"number":0,"customer":0,"footer":"Configuración del usuario.","irm":"Configuración del usuario.","invoice_lines":[{"quantity":0,"concept":"<ADD STRING VALUE>","amount":0,"discount":0,"tax":0,"surcharge":0,"retention":0,"sell_type":"service","tax_regime":"01","tax_subjection_code":"S1"}],"charges":[{"date":"<ADD STRING VALUE>","amount":0,"payment_method":"cash","origin_account":"<ADD STRING VALUE>","destination_account":0,"paid":false}]}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice"
payload := strings.NewReader("{\"currency_info\":{\"currency\":\"EUR\"},\"description\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"date\":\"<ADD STRING VALUE>\",\"serie\":\"<ADD STRING VALUE>\",\"rectified_id\":0,\"rectification_key\":\"R1\",\"rectification_cause\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"issued\":false,\"number\":0,\"customer\":0,\"footer\":\"Configuración del usuario.\",\"irm\":\"Configuración del usuario.\",\"invoice_lines\":[{\"quantity\":0,\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"discount\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"sell_type\":\"service\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
issued boolean |
Este parámetro define si es un borrador o una factura emitida. |
invoice_lines array |
Lineas de factura |
charges array |
Cobros Detalle:La suma de los cobros debe ser igual que el total de la factura. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
currency_info object |
Moneda de la factura. Objeto con un único campo currency (código ISO 4217; ver «Monedas admitidas»). Si se omite, la factura es en euros (EUR). El tipo de cambio lo aplica Cuéntica automáticamente (referencia del BCE) según la fecha de la factura. |
description string |
|
annotations string |
|
date string |
Fecha de facturación Formato: yyyy-MM-dd Debe ser superior o igual a la fecha de la ultima factura emitida ese año con la misma serie, si no se envía fecha se usará la fecha de la petición. |
serie string |
Nombre de la serie de facturación, si no se envía se creará en la serie de facturación por defecto. |
rectified_id integer |
Si se utiliza una serie rectificativa, id de la factura que se quiere rectificar. |
rectification_key string |
Valores aceptados: R1, R2, R3, R4Detalle:Tipo de rectificación. Obligatorio si se indica rectified_id y el cliente está identificado.- R1 — Corrección de error, descuento o devolución (Art. 80.1, 2 y 6 LIVA)- R2 — Concurso de acreedores del cliente (Art. 80.3 LIVA)- R3 — Deuda incobrable (Art. 80.4 LIVA)- R4 — Otro motivo (requiere rectification_cause)Para clientes no identificados (“Clientes varios”) se asigna automáticamente R5 con independencia del valor enviado. |
rectification_cause string |
Motivo libre de la rectificación. Solo se usa cuando rectification_key es R4. |
tags array |
Las etiquetas que quieres que se asignen a la factura. Si no existen se crearán. |
number integer |
Número de factura Si es la primera factura del año y de la serie se cogerá este como el primer numero de factura. Si ya existe una factura con la misma serie y se envía este parametro la petición fallará si no es el que le correspondería. |
customer integer |
Id del cliente al que se emite la factura. Si no se envía un cliente se usará “Clientes varios”. Si la serie de la factura es IVA-OSS deberá ser un cliente de un país de la UE y no español. |
footer string |
Pie de factura por defecto del usuario, que configuró en su panel de administración. |
irm string |
Campo IRM por defecto del usuario para las facturas, que configuró en su panel de administración. |
- Detalle de la respuesta:
| Nombre | Descripción |
|---|---|
| business.business_name | Este campo solo se devuelve si el tipo de la empresa no es individual |
| business.name | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_1 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_2 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| charges.origin_account_number | Este campo se devuelve dependiendo delmétodoo de pago |
| charges.origin_account_description | Este campo se devuelve dependiendo delmétodoo de pago |
| invoice_lines.surcharge | Este campo se devuelve si la linea de factura tiene recargo |
/invoice/:id
curl --request GET \
--url https://api.cuentica.com/invoice/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/invoice/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/invoice/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
- Detalle de la respuesta:
| Nombre | Descripción |
|---|---|
| business.business_name | Este campo solo se devuelve si el tipo de la empresa no es individual |
| business.name | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_1 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_2 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| charges.origin_account_number | Este campo se devuelve dependiendo delmétodoo de pago |
| charges.origin_account_description | Este campo se devuelve dependiendo delmétodoo de pago |
| invoice_lines.surcharge | Este campo se devuelve si la linea de factura tiene recargo |
curl --request PUT \
--url https://api.cuentica.com/invoice/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/invoice/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/invoice/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Adicionalmente a los campos de invoice_lines y de charges detallados en el link de la tabla se añade un nuevo campo opcional id
Comportamiento esperado de lineas y cobros en la actualización de facturas.
* Si contiene el campo id se actualizarán los datos de esa linea o cobro.
* Si no contiene el campo id se creará una nueva linea o cobro.
* Todos los id’s de lineas y cobros que no estén presentes en el objeto que se recibe como parámetro serán eliminados.
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
issued boolean |
Este parámetro define si es un borrador o una factura emitida. |
customer integer |
Id del cliente al que se emite la factura. |
invoice_lines array |
Lineas de factura |
charges array |
Cobros Detalle:La suma de los cobros debe ser igual que el total de la factura. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
currency_info object |
Moneda de la factura. Objeto con un único campo currency (código ISO 4217; ver «Monedas admitidas»). Si se omite, la factura es en euros (EUR). El tipo de cambio lo aplica Cuéntica automáticamente (referencia del BCE) según la fecha de la factura. |
description string |
|
annotations string |
|
date string |
Fecha de facturación Formato: yyyy-MM-dd Debe ser superior o igual a la fecha de la ultima factura emitida ese año con la misma serie, si no se envía fecha se usará la fecha de la petición. |
serie string |
Nombre de la serie de facturación, si no se envía se creará en la serie de facturación por defecto. Si la serie de la factura es IVA-OSS deberá ser un cliente de un país de la UE y no español.‘ |
tags array |
Las etiquetas que quieres que se asignen a la factura. Si no existen se crearán. |
number integer |
Número de factura Si es la primera factura del año y de la serie se cogerá este como el primer numero de factura. Si ya existe una factura con la misma serie y se envía este parametro la petición fallará si no es el que le correspondería. |
footer string |
Pie de factura por defecto del usuario, que configuró en su panel de administración. |
irm string |
Campo IRM por defecto del usuario para las facturas, que configuró en su panel de administración. |
- Detalle de la respuesta:
| Nombre | Descripción |
|---|---|
| business.business_name | Este campo solo se devuelve si el tipo de la empresa no es individual |
| business.name | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_1 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_2 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| charges.origin_account_number | Este campo se devuelve dependiendo delmétodoo de pago |
| charges.origin_account_description | Este campo se devuelve dependiendo delmétodoo de pago |
| invoice_lines.surcharge | Este campo se devuelve si la linea de factura tiene recargo |
curl --request DELETE \
--url https://api.cuentica.com/invoice/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/invoice/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/invoice/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
/invoice/:id/void
curl --request POST \
--url https://api.cuentica.com/invoice/:id/void
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("POST", "/invoice/:id/void")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id/void",
"method": "POST",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/invoice/:id/void")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id/void');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id/void"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Permite anular una factura emitida.
Restricciones importantes:
- La factura debe estar emitida.
- No se puede anular una factura ya anulada.
- No se puede anular una factura que está esperando respuesta de la AEAT (estado waiting_for_response); hay que esperar a que se procese.
- No se pueden anular facturas con rectificativas asociadas a menos que estas también hayan sido anuladas.
Si la factura no cumple estos requisitos, se devuelve un error 400.
- Detalle de la respuesta:
| Nombre | Descripción |
|---|---|
| business.business_name | Este campo solo se devuelve si el tipo de la empresa no es individual |
| business.name | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_1 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_2 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| charges.origin_account_number | Este campo se devuelve dependiendo delmétodoo de pago |
| charges.origin_account_description | Este campo se devuelve dependiendo delmétodoo de pago |
| invoice_lines.surcharge | Este campo se devuelve si la linea de factura tiene recargo |
/invoice/:id/public
curl --request GET \
--url https://api.cuentica.com/invoice/:id/public
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id/public")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/invoice/:id/public")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id/public",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/invoice/:id/public")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id/public');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id/public"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Link de la vista previa de la factura, tendrá el boton de pago a la cuenta de Stripe que tengas configurada en Cuéntica.
/invoice/:id/charges
curl --request PUT \
--url https://api.cuentica.com/invoice/:id/charges
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/invoice/:id/charges")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id/charges",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/invoice/:id/charges")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id/charges');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id/charges"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Adicionalmente al campo de charges detallados en el link de la tabla se añade un nuevo campo opcional id
El comportamiento esperado.
* Si contiene el campo id se actualizarán los datos de ese cobro, en caso de que no exista un cobro con ese id se creará.
* Si no contiene el campo id se creará un nuevo cobro.
* Todos los cobros que existiesen antes pero que no se reciban como parámetro, serán eliminados.
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
charges array |
Cobros Detalle:Listado de cobros que quieres actualizar. |
- Detalle de la respuesta:
| Nombre | Descripción |
|---|---|
| business.business_name | Este campo solo se devuelve si el tipo de la empresa no es individual |
| business.name | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_1 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| business.surname_2 | Este campo solo se devuelve cuando el tipo de la empresa es individual |
| charges.origin_account_number | Este campo se devuelve dependiendo delmétodoo de pago |
| charges.origin_account_description | Este campo se devuelve dependiendo delmétodoo de pago |
| invoice_lines.surcharge | Este campo se devuelve si la linea de factura tiene recargo |
/invoice/:id/email
curl --request POST \
--url https://api.cuentica.com/invoice/:id/email
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id/email")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("POST", "/invoice/:id/email")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id/email",
"method": "POST",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/invoice/:id/email")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id/email');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id/email"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
to array |
Destinatarios del correo. |
reply_to string |
Dirección a la que queremos que contesten. |
subject string |
Asunto del correo. |
body string |
Cuerpo del correo. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
cc array |
Con copia. |
cc_me boolean |
Enviarme copia del correo. |
show_card_payment boolean |
Mostrar botón de pago en el email, este botón irá a la vista pública de la factura. |
include_pdf boolean |
Incluir PDF de la factura en el correo. |
attachments array |
Archivos adjuntos Detalle:Como máximo pueden adjuntarse 5 archivos. |
Respuesta: Status 200
/invoice/:id/pdf
curl --request GET \
--url https://api.cuentica.com/invoice/:id/pdf
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/invoice/:id/pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/invoice/:id/pdf")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/invoice/:id/pdf",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/invoice/:id/pdf")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/invoice/:id/pdf');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/invoice/:id/pdf"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Binario Base64
Ingreso
/income
curl --request GET \
--url https://api.cuentica.com/income
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/income")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/income")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
customer |
Id del cliente. |
min_total_limit |
Los elementos del listado tendrán un total superior a esta cantidad. |
max_total_limit |
Los elementos tendrán un total inferior a esta cantidad. |
initial_date |
Los elementos tendrán una fecha superior a esta. Con formato yyyy-MM-dd. |
end_date |
Los elementos tendrán una fecha inferior a esta. Con formato yyyy-MM-dd. |
sort |
Es una lista con los valores por los que se quiere ordenar, con el formato: sort=key:order,key:order,key:order Las key válidas son:* customer -> Ordenar alfabéticamente por cliente. * document_number -> Ordenar alfabéticamente por nº de documento. * total_base-> Ordenar por total de la base del ingreso. * total_income -> Ordenar por total de ingreso. * date -> Ordenar por fecha. Los order válidos son:* desc -> Mayor a menor. * asc -> Menor a mayor. |
tags |
Lista de tags por los que se quiere buscar: tag_1,tag_2 Se devolverán lso resultados que contengan Todos los tags |
curl --request POST \
--url https://api.cuentica.com/income \
--data '{"customer":0,"date":"<ADD STRING VALUE>","tags":["<ADD STRING VALUE>"],"document_type":"other_invoice","document_number":"<ADD STRING VALUE>","annotations":"<ADD STRING VALUE>","income_lines":[{"concept":"<ADD STRING VALUE>","amount":0,"tax":0,"retention":0,"imputation":0,"income_type":"<ADD STRING VALUE>","tax_regime":"01","tax_subjection_code":"S1"}],"charges":[{"date":"<ADD STRING VALUE>","amount":0,"payment_method":"cash","origin_account":"<ADD STRING VALUE>","destination_account":0,"paid":false}]}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"customer\":0,\"date\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"document_type\":\"other_invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"income_lines\":[{\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"tax\":0,\"retention\":0,\"imputation\":0,\"income_type\":\"<ADD STRING VALUE>\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"customer\":0,\"date\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"document_type\":\"other_invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"income_lines\":[{\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"tax\":0,\"retention\":0,\"imputation\":0,\"income_type\":\"<ADD STRING VALUE>\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}"
conn.request("POST", "/income", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"customer\":0,\"date\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"document_type\":\"other_invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"income_lines\":[{\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"tax\":0,\"retention\":0,\"imputation\":0,\"income_type\":\"<ADD STRING VALUE>\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/income")
.body("{\"customer\":0,\"date\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"document_type\":\"other_invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"income_lines\":[{\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"tax\":0,\"retention\":0,\"imputation\":0,\"income_type\":\"<ADD STRING VALUE>\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"customer":0,"date":"<ADD STRING VALUE>","tags":["<ADD STRING VALUE>"],"document_type":"other_invoice","document_number":"<ADD STRING VALUE>","annotations":"<ADD STRING VALUE>","income_lines":[{"concept":"<ADD STRING VALUE>","amount":0,"tax":0,"retention":0,"imputation":0,"income_type":"<ADD STRING VALUE>","tax_regime":"01","tax_subjection_code":"S1"}],"charges":[{"date":"<ADD STRING VALUE>","amount":0,"payment_method":"cash","origin_account":"<ADD STRING VALUE>","destination_account":0,"paid":false}]}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income"
payload := strings.NewReader("{\"customer\":0,\"date\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"document_type\":\"other_invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"annotations\":\"<ADD STRING VALUE>\",\"income_lines\":[{\"concept\":\"<ADD STRING VALUE>\",\"amount\":0,\"tax\":0,\"retention\":0,\"imputation\":0,\"income_type\":\"<ADD STRING VALUE>\",\"tax_regime\":\"01\",\"tax_subjection_code\":\"S1\"}],\"charges\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"paid\":false}]}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
customer integer |
Id del cliente al que se cobra el ingreso. |
income_lines array |
Lineas de ingreso |
charges array |
Cobros Detalle:La suma de los cobros debe ser igual que el total del ingreso. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
date string |
Fecha del ingreso. Formato: yyyy-MM-dd Si no se envía fecha se usará la fecha de la petición. |
tags array |
Las etiquetas que quieres que se asignen al ingreso. Si no existen se crearán. |
document_type string |
Valores aceptados: other_invoice, cash_statement, interest_settlement, bank_doc, contract, resolution, other_docDetalle:Tipo de ingreso que se va a guardar.. |
document_number string |
Número de ingreso. |
annotations string |
Comentario personal sobre el ingreso |
attachment object |
Archivo adjunto |
/income/:id
curl --request GET \
--url https://api.cuentica.com/income/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/income/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/income/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request PUT \
--url https://api.cuentica.com/income/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/income/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/income/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Adicionalmente a los campos de income_lines y de charges detallados en el link de la tabla se añade un nuevo campo opcional id
Comportamiento esperado de lineas y cobros en la actualización de ingresos.
* Si contiene el campo id se actualizarán los datos de esa linea o cobro.
* Si no contiene el campo id se creará una nueva linea o cobro.
* Todos los id’s de lineas y cobros que no estén presentes en el objeto que se recibe como parámetro serán eliminados.
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
customer integer |
Id del cliente al que se cobra el ingreso. |
income_lines array |
Lineas de ingreso |
charges array |
Cobros Detalle:La suma de los cobros debe ser igual que el total del ingreso. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
date string |
Fecha del ingreso. Formato: yyyy-MM-dd Si no se envía fecha se usará la fecha de la petición. |
tags array |
Las etiquetas que quieres que se asignen al ingreso. Si no existen se crearán. |
document_type string |
Valores aceptados: other_invoice, cash_statement, interest_settlement, bank_doc, contract, resolution, other_docDetalle:Tipo de ingreso que se va a guardar.. |
document_number string |
Número de ingreso. |
annotations string |
Comentario personal sobre el ingreso |
attachment object |
Archivo adjunto |
curl --request DELETE \
--url https://api.cuentica.com/income/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/income/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/income/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
/income/:id/attachment
curl --request GET \
--url https://api.cuentica.com/income/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/income/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id/attachment",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/income/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id/attachment');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id/attachment"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request DELETE \
--url https://api.cuentica.com/income/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/income/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id/attachment",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/income/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id/attachment');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id/attachment"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
curl --request PUT \
--url https://api.cuentica.com/income/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/income/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id/attachment",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/income/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id/attachment');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id/attachment"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
filename string |
Nombre del archivo que tendrá cuando se envíe. |
data string |
El fichero en Base64. |
/income/:id/charges
curl --request PUT \
--url https://api.cuentica.com/income/:id/charges
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/income/:id/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/income/:id/charges")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/income/:id/charges",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/income/:id/charges")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/income/:id/charges');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/income/:id/charges"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Adicionalmente al campo de charges detallados en el link de la tabla se añade un nuevo campo opcional id
El comportamiento esperado.
* Si contiene el campo id se actualizarán los datos de ese cobro, en caso de que no exista un cobro con ese id se creará.
* Si no contiene el campo id se creará un nuevo cobro.
* Todos los cobros que existiesen antes pero que no se reciban como parámetro, serán eliminados.
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
charges array |
Cobros Detalle:Listado de cobros que quieres actualizar. |
Gasto
/expense
curl --request GET \
--url https://api.cuentica.com/expense
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/expense")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/expense")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
provider |
Id del proveedor. |
min_total_limit |
Los elementos del listado tendrán un total superior a esta cantidad. |
max_total_limit |
Los elementos tendrán un total inferior a esta cantidad. |
initial_date |
Los elementos tendrán una fecha superior a esta. Con formato yyyy-MM-dd. |
end_date |
Los elementos tendrán una fecha inferior a esta. Con formato yyyy-MM-dd. |
expense_type |
Devolverá los gastos con este tipo de gasto. |
investment_type |
Devolverá los gastos con este tipo de inversión. |
draft |
true -> Mostrar borradoresfalse -> Mostrar gastos confirmados |
sort |
Es una lista con los valores por los que se quiere ordenar, con el formato: sort=key:order,key:order,key:order Las key válidas son:* provider -> Ordenar alfabéticamente cliente. * document_number -> Ordenar alfabéticamente por nº de documento. * total_base -> Ordenar por total de la base del gasto. * total_expense -> Ordenar por total del gasto. * date -> Ordenar por fecha. Los order válidos son:* desc -> Mayor a menor. * asc -> Menor a mayor. |
tags |
Lista de tags por los que se quiere buscar: tag_1,tag_2 Se devolverán lso resultados que contengan Todos los tags |
curl --request POST \
--url https://api.cuentica.com/expense \
--data '{"date":"<ADD STRING VALUE>","draft":false,"provider":0,"document_type":"invoice","document_number":"<ADD STRING VALUE>","tags":["<ADD STRING VALUE>"],"annotations":"<ADD STRING VALUE>","expense_lines":[{"description":"<ADD STRING VALUE>","base":0,"tax":0,"surcharge":0,"retention":0,"imputation":0,"expense_type":"<ADD STRING VALUE>","investment":false}],"payments":[{"date":"<ADD STRING VALUE>","amount":0,"payment_method":"cash","origin_account":0,"destination_account":"<ADD STRING VALUE>","paid":false}],"vat_eu":false}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"date\":\"<ADD STRING VALUE>\",\"draft\":false,\"provider\":0,\"document_type\":\"invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"annotations\":\"<ADD STRING VALUE>\",\"expense_lines\":[{\"description\":\"<ADD STRING VALUE>\",\"base\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"imputation\":0,\"expense_type\":\"<ADD STRING VALUE>\",\"investment\":false}],\"payments\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":0,\"destination_account\":\"<ADD STRING VALUE>\",\"paid\":false}],\"vat_eu\":false}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"date\":\"<ADD STRING VALUE>\",\"draft\":false,\"provider\":0,\"document_type\":\"invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"annotations\":\"<ADD STRING VALUE>\",\"expense_lines\":[{\"description\":\"<ADD STRING VALUE>\",\"base\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"imputation\":0,\"expense_type\":\"<ADD STRING VALUE>\",\"investment\":false}],\"payments\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":0,\"destination_account\":\"<ADD STRING VALUE>\",\"paid\":false}],\"vat_eu\":false}"
conn.request("POST", "/expense", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"date\":\"<ADD STRING VALUE>\",\"draft\":false,\"provider\":0,\"document_type\":\"invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"annotations\":\"<ADD STRING VALUE>\",\"expense_lines\":[{\"description\":\"<ADD STRING VALUE>\",\"base\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"imputation\":0,\"expense_type\":\"<ADD STRING VALUE>\",\"investment\":false}],\"payments\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":0,\"destination_account\":\"<ADD STRING VALUE>\",\"paid\":false}],\"vat_eu\":false}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/expense")
.body("{\"date\":\"<ADD STRING VALUE>\",\"draft\":false,\"provider\":0,\"document_type\":\"invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"annotations\":\"<ADD STRING VALUE>\",\"expense_lines\":[{\"description\":\"<ADD STRING VALUE>\",\"base\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"imputation\":0,\"expense_type\":\"<ADD STRING VALUE>\",\"investment\":false}],\"payments\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":0,\"destination_account\":\"<ADD STRING VALUE>\",\"paid\":false}],\"vat_eu\":false}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"date":"<ADD STRING VALUE>","draft":false,"provider":0,"document_type":"invoice","document_number":"<ADD STRING VALUE>","tags":["<ADD STRING VALUE>"],"annotations":"<ADD STRING VALUE>","expense_lines":[{"description":"<ADD STRING VALUE>","base":0,"tax":0,"surcharge":0,"retention":0,"imputation":0,"expense_type":"<ADD STRING VALUE>","investment":false}],"payments":[{"date":"<ADD STRING VALUE>","amount":0,"payment_method":"cash","origin_account":0,"destination_account":"<ADD STRING VALUE>","paid":false}],"vat_eu":false}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense"
payload := strings.NewReader("{\"date\":\"<ADD STRING VALUE>\",\"draft\":false,\"provider\":0,\"document_type\":\"invoice\",\"document_number\":\"<ADD STRING VALUE>\",\"tags\":[\"<ADD STRING VALUE>\"],\"annotations\":\"<ADD STRING VALUE>\",\"expense_lines\":[{\"description\":\"<ADD STRING VALUE>\",\"base\":0,\"tax\":0,\"surcharge\":0,\"retention\":0,\"imputation\":0,\"expense_type\":\"<ADD STRING VALUE>\",\"investment\":false}],\"payments\":[{\"date\":\"<ADD STRING VALUE>\",\"amount\":0,\"payment_method\":\"cash\",\"origin_account\":0,\"destination_account\":\"<ADD STRING VALUE>\",\"paid\":false}],\"vat_eu\":false}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
date string |
Con formato -> yyyy-MM-dd |
draft boolean |
|
provider integer |
|
document_type string |
Valores aceptados: invoice, ticketDetalle:Los documentos pueden ser facturas o ticket. |
expense_lines array |
Lineas de gasto |
payments array |
Pagos |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
document_number string |
|
tags array |
Las etiquetas que quieres que se asignen al gasto. Si no existen se crearán. |
annotations string |
|
vat_eu boolean |
Indica si es un gasto correspondiente a una Factura emitida con CIF europeo. (En la factura, el CIF o el VAT ID empieza por “EU”). |
attachment object |
Archivo adjunto |
/expense/:id
curl --request GET \
--url https://api.cuentica.com/expense/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/expense/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/expense/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request PUT \
--url https://api.cuentica.com/expense/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/expense/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/expense/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Adicionalmente a los campos de expense_lines y de payments detallados en el link de la tabla de añade un nuevo campo opcional id
Comportamiento esperado de lineas y pagos en la actualización de facturas.
* Si contiene el campo id se actualizarán los datos de esa linea o cobro.
* Si no contiene el campo id se creará una nueva linea o cobro.
* Todos los id’s de lineas y pagos que no estén presentes en el objeto que se recibe como parámetro serán eliminados.
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
date string |
Con formato -> yyyy-MM-dd |
draft boolean |
|
provider integer |
|
document_type string |
Valores aceptados: invoice, ticketDetalle:Los documentos pueden ser facturas o ticket. |
expense_lines array |
Lineas de gasto |
payments array |
Pagos |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
document_number string |
|
tags array |
Las etiquetas que quieres que se asignen al gasto. Si no existen se crearán. |
annotations string |
|
vat_eu boolean |
Indica si es un gasto correspondiente a una Factura emitida con CIF europeo. (En la factura, el CIF o el VAT ID empieza por “EU”). |
attachment object |
Archivo adjunto |
curl --request DELETE \
--url https://api.cuentica.com/expense/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/expense/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/expense/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
/expense/:id/attachment
curl --request GET \
--url https://api.cuentica.com/expense/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/expense/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id/attachment",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/expense/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id/attachment');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id/attachment"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request DELETE \
--url https://api.cuentica.com/expense/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/expense/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id/attachment",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/expense/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id/attachment');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id/attachment"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
curl --request PUT \
--url https://api.cuentica.com/expense/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/expense/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id/attachment",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/expense/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id/attachment');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id/attachment"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
filename string |
Nombre del archivo que tendrá cuando se envíe. |
data string |
El fichero en Base64. |
/expense/:id/payments
curl --request PUT \
--url https://api.cuentica.com/expense/:id/payments
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/expense/:id/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/expense/:id/payments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/expense/:id/payments",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/expense/:id/payments")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/expense/:id/payments');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/expense/:id/payments"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Adicionalmente al campo de payments detallados en el link de la tabla se añade un nuevo campo opcional id
El comportamiento esperado.
* Si contiene el campo id se actualizarán los datos de ese pago, en caso de que no exista un pago con ese id se creará.
* Si no contiene el campo id se creará un nuevo pago.
* Todos los pagos que existiesen antes pero que no se reciban como parámetro, serán eliminados.
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
payments array |
Pagos Detalle:Listado de pagos que quieres actualizar. |
Documento
/document
curl --request GET \
--url https://api.cuentica.com/document
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/document")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/document",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/document")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/document');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/document"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
sort |
* desc -> Mayor a menor.* asc -> Menor a mayor. |
initial_date |
Los elementos tendrán una fecha superior a esta. Con formato yyyy-MM-dd. |
end_date |
Los elementos tendrán una fecha inferior a esta. Con formato yyyy-MM-dd. |
keyword |
texto a buscar en el nombre o asunto |
assigned |
* true -> Mostrar procesados* false -> Mostrar pendientes |
extension |
Lista de extensiones por las que se quiere buscar. Se puede indicar “!” para excluir de los resultados. !pdf,jpg,jpeg |
hash |
hash del fichero en algoritmo MD5 |
curl --request POST \
--url https://api.cuentica.com/document \
--data '{"date":"<ADD STRING VALUE>","expense_id":0}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"date\":\"<ADD STRING VALUE>\",\"expense_id\":0}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"date\":\"<ADD STRING VALUE>\",\"expense_id\":0}"
conn.request("POST", "/document", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/document",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"date\":\"<ADD STRING VALUE>\",\"expense_id\":0}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/document")
.body("{\"date\":\"<ADD STRING VALUE>\",\"expense_id\":0}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/document');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"date":"<ADD STRING VALUE>","expense_id":0}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/document"
payload := strings.NewReader("{\"date\":\"<ADD STRING VALUE>\",\"expense_id\":0}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
attachment object |
Archivo adjunto |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
date string |
Con formato -> yyyy-MM-dd |
expense_id integer |
id del gasto asociado al documento |
/document/:id
curl --request GET \
--url https://api.cuentica.com/document/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/document/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/document/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/document/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/document/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/document/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/document/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request PUT \
--url https://api.cuentica.com/document/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/document/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/document/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/document/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/document/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/document/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/document/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Descripción: Solo se permite cambiar
* expense_id: gasto asignado
* date: fecha del documento
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
attachment object |
Archivo adjunto |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
date string |
Con formato -> yyyy-MM-dd |
expense_id integer |
id del gasto asociado al documento |
curl --request DELETE \
--url https://api.cuentica.com/document/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/document/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/document/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/document/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/document/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/document/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/document/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
/document/:id/attachment
curl --request GET \
--url https://api.cuentica.com/document/:id/attachment
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/document/:id/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/document/:id/attachment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/document/:id/attachment",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/document/:id/attachment")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/document/:id/attachment');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/document/:id/attachment"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Etiqueta
/tag
curl --request GET \
--url https://api.cuentica.com/tag
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/tag")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/tag")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/tag",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/tag")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/tag');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/tag"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Traspaso
/transfer
curl --request GET \
--url 'https://api.cuentica.com/transfer?origin_account=SOME_INTEGER_VALUE&destination_account=SOME_INTEGER_VALUE&payment_method=SOME_STRING_VALUE&sort=SOME_STRING_VALUE'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/transfer?origin_account=SOME_INTEGER_VALUE&destination_account=SOME_INTEGER_VALUE&payment_method=SOME_STRING_VALUE&sort=SOME_STRING_VALUE")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/transfer?origin_account=SOME_INTEGER_VALUE&destination_account=SOME_INTEGER_VALUE&payment_method=SOME_STRING_VALUE&sort=SOME_STRING_VALUE")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/transfer?origin_account=SOME_INTEGER_VALUE&destination_account=SOME_INTEGER_VALUE&payment_method=SOME_STRING_VALUE&sort=SOME_STRING_VALUE",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/transfer?origin_account=SOME_INTEGER_VALUE&destination_account=SOME_INTEGER_VALUE&payment_method=SOME_STRING_VALUE&sort=SOME_STRING_VALUE")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/transfer');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'origin_account' => 'SOME_INTEGER_VALUE',
'destination_account' => 'SOME_INTEGER_VALUE',
'payment_method' => 'SOME_STRING_VALUE',
'sort' => 'SOME_STRING_VALUE'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/transfer?origin_account=SOME_INTEGER_VALUE&destination_account=SOME_INTEGER_VALUE&payment_method=SOME_STRING_VALUE&sort=SOME_STRING_VALUE"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros opcionales en la URL
| Nombre | Descripción |
|---|---|
origin_account |
Id de la cuenta de origen que queremos filtrar. |
destination_account |
Id de la cuenta de destino que queremos filtrar. |
payment_method |
Este es el método por el cual se ha hecho el traspaso. |
sort |
El tipo de orden que queremos para ordenar por fecha, ascendente odescendente. sort=asc Los valores válidos son:* desc -> Mayor a menor. * asc -> Menor a mayor. |
page_size |
Número de elementos que quieren obtenerse por página. |
page |
Página que se quiere obtener. |
min_total_limit |
Los elementos del listado tendrán un total superior a esta cantidad. |
max_total_limit |
Los elementos tendrán un total inferior a esta cantidad. |
initial_date |
Los elementos tendrán una fecha superior a esta. Con formato yyyy-MM-dd. |
end_date |
Los elementos tendrán una fecha inferior a esta. Con formato yyyy-MM-dd. |
curl --request POST \
--url https://api.cuentica.com/transfer \
--data '{"amount":0,"payment_method":"cash","date":"<ADD STRING VALUE>","concept":"<ADD STRING VALUE>","destination_account":0,"origin_account":0}'
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/transfer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request.body = "{\"amount\":0,\"payment_method\":\"cash\",\"date\":\"<ADD STRING VALUE>\",\"concept\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"origin_account\":0}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
payload = "{\"amount\":0,\"payment_method\":\"cash\",\"date\":\"<ADD STRING VALUE>\",\"concept\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"origin_account\":0}"
conn.request("POST", "/transfer", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/transfer",
"method": "POST",
"headers": {},
"processData": false,
"data": "{\"amount\":0,\"payment_method\":\"cash\",\"date\":\"<ADD STRING VALUE>\",\"concept\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"origin_account\":0}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.post("https://api.cuentica.com/transfer")
.body("{\"amount\":0,\"payment_method\":\"cash\",\"date\":\"<ADD STRING VALUE>\",\"concept\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"origin_account\":0}")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/transfer');
$request->setMethod(HTTP_METH_POST);
$request->setBody('{"amount":0,"payment_method":"cash","date":"<ADD STRING VALUE>","concept":"<ADD STRING VALUE>","destination_account":0,"origin_account":0}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/transfer"
payload := strings.NewReader("{\"amount\":0,\"payment_method\":\"cash\",\"date\":\"<ADD STRING VALUE>\",\"concept\":\"<ADD STRING VALUE>\",\"destination_account\":0,\"origin_account\":0}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
amount number |
|
concept string |
No puede ser un texto vacío. |
destination_account integer |
id de la cuenta de destino del traspaso. |
origin_account integer |
id de la cuenta de origen del traspaso. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
payment_method string |
Valores aceptados: cash, wire_transfer, promissory_noteDetalle:Este es el método por el cual se ha hecho el traspaso. |
date string |
Fecha del traspaso Formato: yyyy-MM-dd |
/transfer/:id
curl --request GET \
--url https://api.cuentica.com/transfer/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/transfer/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("GET", "/transfer/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/transfer/:id",
"method": "GET",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.get("https://api.cuentica.com/transfer/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/transfer/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/transfer/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request PUT \
--url https://api.cuentica.com/transfer/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/transfer/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("PUT", "/transfer/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/transfer/:id",
"method": "PUT",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.put("https://api.cuentica.com/transfer/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/transfer/:id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/transfer/:id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Parámetros obligatorios en la petición
| Nombre | Descripción |
|---|---|
amount number |
|
concept string |
No puede ser un texto vacío. |
destination_account integer |
id de la cuenta de destino del traspaso. |
origin_account integer |
id de la cuenta de origen del traspaso. |
Parámetros opcionales en la petición
| Nombre | Descripción |
|---|---|
payment_method string |
Valores aceptados: cash, wire_transfer, promissory_noteDetalle:Este es el método por el cual se ha hecho el traspaso. |
date string |
Fecha del traspaso Formato: yyyy-MM-dd |
curl --request DELETE \
--url https://api.cuentica.com/transfer/:id
require 'uri'
require 'net/http'
url = URI("https://api.cuentica.com/transfer/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cuentica.com")
conn.request("DELETE", "/transfer/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cuentica.com/transfer/:id",
"method": "DELETE",
"headers": {}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
HttpResponse<String> response = Unirest.delete("https://api.cuentica.com/transfer/:id")
.asString();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cuentica.com/transfer/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cuentica.com/transfer/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Respuesta: Status 200
Subentidades
Linea de factura
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| quantity double |
true | |
| concept string |
No puede ser un texto vacío. | true |
| amount double |
true | |
| discount double |
No puede ser negativo. No aplica a los gastos suplidos, donde será siempre 0%. |
true |
| tax double |
Valores aceptados: 0.0, 3.0, 4.0, 7.0, 9.5, 10.0, 12.0, 13.5, 20.0, 21.0Detalle:IVA: 0.0, 4.0, 10.0, 12.0, 21.0 IGIC: 0.0, 3.0, 7.0, 9.5, 13.5, 20.0 No aplica a los gastos suplidos, donde será siempre 0%. |
true |
| surcharge double |
En caso de que el cliente al que se factura tenga activado el recargo de equivalencia y no se adjunte este valor se guardará el valor por defecto. Si el cliente no tiene activado el recargo de equivalencia el parámetro no debe incluirse en la petición. No aplica a los gastos suplidos, donde será siempre 0%. |
false |
| retention double |
No puede ser negativo. No aplica a los gastos suplidos, donde será siempre 0%. |
true |
| sell_type string |
Valores aceptados: service, product, supplied_costDetalle:Se ha prestado un servicio, se ha vendido un bien o se está repercutiendo un gasto suplido. |
true |
| tax_regime string |
Valores aceptados Detalle:Clasificación de tipo de operación. Si por los datos se puede inferir la clave, el campo será opcional y se configurará automáticamente en caso de no enviarse. No aplica a los gastos suplidos. |
true |
| tax_subjection_code string |
Valores aceptados Detalle:Clasificación de sujeción/exención de IVA. Si por los datos se puede inferir la clave, el campo será opcional y se configurará automáticamente en caso de no enviarse. No aplica a los gastos suplidos. |
true |
Linea de ingreso
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| concept string |
No puede ser un texto vacío. | true |
| amount double |
true | |
| tax double |
true | |
| retention double |
No puede ser negativo | true |
| imputation double |
No puede ser negativo | true |
| income_type string |
Valores aceptados Detalle:Si no se envía se usará el tipo de ingreso 759 Otro ingreso | true |
| tax_regime string |
Valores aceptados Detalle:Clasificación de tipo de operación. Si por los datos se puede inferir la clave, el campo será opcional y se configurará automáticamente en caso de no enviarse. |
true |
| tax_subjection_code string |
Valores aceptados Detalle:Clasificación de sujeción/exención de IVA. Si por los datos se puede inferir la clave, el campo será opcional y se configurará automáticamente en caso de no enviarse. |
true |
Cobro de factura
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| date string |
Fecha de cobro Con formato -> yyyy-MM-dd |
false |
| amount double |
true | |
| payment_method string |
Valores aceptados: cash, receipt, wire_transfer, card, promissory_note, otherDetalle:Método de cobro con el que se realiza este cobro. |
true |
| origin_account string |
Número de cuenta del cliente a la que se va a cobrar el importe del cobro. |
false |
| destination_account long |
Id de la cuenta del usuario a la que se va a ingresar el cobro. |
true |
| paid boolean |
El cobro ha sido realizado. | true |
Linea de gasto
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| description string |
true | |
| base double |
true | |
| tax double |
true | |
| surcharge double |
false | |
| retention double |
true | |
| imputation double |
true | |
| expense_type string |
Valores aceptados Detalle:Este campo es obligatorio si investment es false. |
false |
| investment boolean |
false | |
| investment_data object |
Datos de la inversion Detalle:Este campo solo es obligatorio el campo investment es true. |
false |
Pago de gasto
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| date string |
Con formato -> yyyy-MM-dd | false |
| amount double |
true | |
| payment_method string |
Valores aceptados: cash, receipt, wire_transfer, card, promissory_note, otherDetalle:Método de pago con el que se realiza este gasto. |
true |
| origin_account long |
Id de la cuenta de la empresa con la que se va a realizar el pago. | true |
| destination_account string |
La cuenta del proveedor al que vamos a pagarle. | false |
| paid boolean |
true |
Detalles de inversion
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| investment_type string |
Valores aceptados | true |
| value double |
true | |
| start_date string |
Con formato -> yyyy-MM-dd | true |
| end_date string |
Con formato -> yyyy-MM-dd | true |
| duration integer |
true | |
| used boolean |
true |
Adjunto
Descripción del objeto: Volver
| Nombre del campo | Descripción | Obligatorio |
|---|---|---|
| filename string |
Nombre del archivo que tendrá cuando se envíe. | true |
| data string |
El fichero en Base64. | true |
Regiones
Listado de regiones aceptadas para España
Para facilitar un poco este campo, la región se normaliza al procesarse, pasando todo a minusculas y eliminando acentos.
Álava = alava = áLÁVá
- A Coruña
- Álava
- Albacete
- Alicante
- Almería
- Asturias
- Ávila
- Badajoz
- Barcelona
- Bizkaia
- Burgos
- Cáceres
- Cádiz
- Cantabria
- Castellón
- Ceuta
- Ciudad Real
- Córdoba
- Cuenca
- Girona
- Granada
- Guadalajara
- Gipuzkoa
- Huelva
- Huesca
- Illes Balears
- Jaén
- La Rioja
- Las Palmas
- León
- Lleida
- Lugo
- Madrid
- Málaga
- Melilla
- Murcia
- Navarra
- Ourense
- Palencia
- Pontevedra
- Salamanca
- Segovia
- Sevilla
- Soria
- Tarragona
- Santa Cruz de Tenerife
- Teruel
- Toledo
- Valencia
- Valladolid
- Zamora
- Zaragoza
Tipos de gasto
| Código | Significado |
|---|---|
| 600 | Compras de productos para vender |
| 601 | Compras de materias primas |
| 602 | Compras de otros aprovisionamientos |
| 607 | Trabajos realizados otras empresas |
| 6210001 | Alquiler de inmuebles y locales |
| 6210002 | Alquiler de bienes y equipos |
| 6210003 | Otros alquileres |
| 622 | Reparaciones, mantenimiento y limpieza |
| 6230001 | Asesoria fiscal y contable |
| 6230002 | Asesoria Laboral |
| 6230005 | Otros servicios profesionales |
| 624 | Gastos de transporte |
| 625 | Primas de seguro |
| 626 | Comisiones y gastos bancarios |
| 627 | Gastos de publicidad y propaganda |
| 6280003 | Gasolinas / Combustibles |
| 6280004 | Electricidad |
| 6280005 | Agua |
| 6280006 | Telefonía |
| 6280007 | Otros suministros |
| 6290001 | Papelería y material de oficina |
| 6290002 | Restaurante y hostelería |
| 6290003 | Gastos de viaje y locomoción |
| 6290004 | Hosting y servicios web |
| 6290005 | Formación y cursos |
| 6290006 | Otros servicios externos |
| 6310001 | Impuestos y tasas municipales |
| 6310002 | Impuestos y tasas de la comunidad autonoma |
| 6400000 | Nóminas de socios |
| 6400001 | Nóminas de trabajadores |
| 6420000 | Seguridad Social autónomos |
| 6420001 | Seguridad Social régimen general |
| 662 | Intereses de préstamos |
| 669 | Otros gastos financieros |
| 678 | Gastos extraordinarios |
| 680 | Amortización de Invers. Inmateriales |
| 681 | Amortización de Invers. Materiales |
| 682 | Amortización de Invers. Inmobiliarias |
| 699 | Gastos no deducibles |
| 520 | Devolución principal de préstamo |
| 475 | Impuestos trimestrales hacienda estatal |
Tipos de inversión
| Código | Significado |
|---|---|
| 20 | Inmovilizaciones intangibles |
| 200 | Investigación |
| 201 | Desarrollo |
| 202 | Concesiones administrativas |
| 203 | Propiedad industrial |
| 205 | Derechos de traspaso |
| 206 | Aplicaciones informáticas |
| 21 | Inmovilizaciones materiales |
| 210 | Terrenos y bienes naturales |
| 211 | Construcciones |
| 212 | Instalaciones técnicas |
| 213 | Maquinaria |
| 214 | Utillaje Y herramientas |
| 215 | Otras instalaciones |
| 216 | Mobiliario |
| 217 | Equipos para procesos de información |
| 218 | Elementos de transporte |
| 219 | Otro inmovilizado material |
| 250 | Otras inversiones financieras a largo plazo |
| 260 | Fianzas y depositos constituidos a largo plazo |
Tipos de ingreso
| Código | Significado |
|---|---|
| 700 | Venta de productos |
| 705 | Prestacion de servicios |
| 730 | Autoconsumo |
| 740 | Subvenciones ejercicio |
| 746 | Subvenciones otros ejercicios |
| 752 | Ingreso por alquileres |
| 754 | Ingresos por comisiones |
| 759 | Otros ingresos |
| 766 | Ingresos financieros |
| 778 | Ingresos extraordinarios |
| 799 | Ingresos no imputables |
Tipos de venta
| Código | Significado |
|---|---|
| service | Prestación de servicio |
| product | Venta de un producto/bien |
| supplied_cost | Gasto suplido |
Tipos de operación
| Código | Significado |
|---|---|
| 01 | Régimen general |
| 02 | Exportación |
| 08 | IGIC |
| 11 | Arrendamiento de local de negocio |
| 17 | IVA OSS |
| 18 | Recargo de equivalencia |
| 20 | Régimen simplificado |
Tipos de sujeción de IVA
| Código | Significado |
|---|---|
| S1 | Operación sujeta y no exenta sin inversión del sujeto pasivo. El caso general cuando se vende con IVA. |
| S2 | Operación sujeta y no exenta con inversión del sujeto pasivo. El comprador es quien declara el IVA. Operaciones transfronterizas o entre empresas. |
| N1 | Operación no sujeta por el artículo 7, 14 u otros motivos. Operaciones que no pagan IVA. Transmisiones de empresas, entregas gratuitas de bienes… |
| N2 | Operación no sujeta por reglas de localización. Cuando el servicio o producto está fuera del territorio español. |
| E1 | Exenta por el artículo 20. Actividades de formación/educativas, sanitarias o financieras que están exentas de IVA por ley. |
| E2 | Exenta por el artículo 21. Principalmente para exportaciones de bienes fuera de la UE. |
| E3 | Exenta por el artículo 22. Bienes en tránsito dentro de la UE, como las importaciones temporales. |
| E4 | Exenta por el artículo 23 y 24. Relacionado con bienes exportados a territorios fuera de la UE o exenciones en zonas francas. |
| E5 | Exenta por el artículo 25. Venta intracomunitaria de bienes |
Monedas admitidas
Las facturas pueden emitirse en cualquiera de las siguientes monedas, indicando su código ISO 4217 en currency_info.currency. Si no se indica moneda, la factura es en euros (EUR).
El tipo de cambio lo aplica Cuéntica automáticamente con la referencia del Banco Central Europeo (BCE) según la fecha de la factura. Los importes de amount_details se devuelven siempre en euros; el importe de cada línea en la moneda original está disponible en amount_currency.
| Código | Moneda | Zona / País |
|---|---|---|
AUD |
Dólar australiano | Australia |
CHF |
Franco suizo | Suiza |
CNY |
Yuan chino (renminbi) | China |
DKK |
Corona danesa | Dinamarca |
EUR |
Euro | Zona euro |
GBP |
Libra esterlina | Reino Unido |
HKD |
Dólar de Hong Kong | Hong Kong |
JPY |
Yen japonés | Japón |
MXN |
Peso mexicano | México |
NOK |
Corona noruega | Noruega |
PLN |
Esloti polaco | Polonia |
SEK |
Corona sueca | Suecia |
USD |
Dólar estadounidense | Estados Unidos |
Verifactu / TicketBAI
El campo register_info describe el estado de registro de la factura. En empresas con Verifactu o TicketBAI refleja el registro y envío a las autoridades fiscales; en el resto, la validación interna de Cuéntica (estado validated, sin envío a Hacienda).
Estructura del objeto
| Nombre del campo | Tipo | Descripción |
|---|---|---|
| source | string |
Sistema de registro utilizado para esta factura. Valores posibles: "" (vacío), "ticketbai", "verifactu" |
| registration_code | integer |
Código numérico que indica el tipo de registro de la factura |
| registration_description | string |
Descripción textual del tipo de registro |
| status_code | integer |
Código numérico que indica el estado del registro de la factura |
| status_description | string |
Descripción textual del estado del registro |
| url | string |
URL de acceso al registro de la factura en el sistema correspondiente (TicketBAI o Verifactu) |
| qr | string |
Código QR en formato Base64 para acceso rápido al registro de la factura. Solo se incluye si existe URL |
registration_code
| Código | Descripción |
|---|---|
0 |
Sin registrar |
1 |
Registro Verifactu con envío automático a la AEAT |
2 |
Registro Verifactu sin envío a la AEAT |
3 |
Registro TicketBAI con envío automático |
registration_description
| Valor | Descripción |
|---|---|
"" |
Sin registro |
"auto" |
Registro con envío automático (Verifactu o TicketBAI) |
"manual" |
Registro sin envío automático (Verifactu) |
status_code
| Código | Descripción |
|---|---|
-2 |
Error de validación |
-1 |
Rechazada |
0 |
Sin enviar |
1 |
Aceptada |
2 |
Aceptada con errores |
3 |
Anulada |
4 |
Esperando respuesta de la AEAT |
5 |
Firmada (Verifactu sin envío automático) |
6 |
Validada por el sistema de Cuéntica (sin envío a Hacienda) |
status_description
| Valor | Descripción |
|---|---|
"invalid" |
Error de validación |
"rejected" |
Rechazado por las autoridades fiscales |
"not_sent" |
Aún no se ha enviado |
"accepted" |
Aceptada correctamente |
"accepted_with_errors" |
Aceptada pero con advertencias |
"voided" |
Factura anulada |
"waiting_for_response" |
Esperando confirmación |
"signed" |
Firmada digitalmente |
"validated" |
Validada por el sistema, sin envío a Hacienda |
"unknown" |
Estado desconocido |
Ejemplo de respuesta
{
"register_info": {
"source": "verifactu",
"registration_code": 1,
"registration_description": "auto",
"status_code": 1,
"status_description": "accepted",
"url": "https://www2.agenciatributaria.gob.es/wlpl/TIKE-CONT/ValidarQR?nif=B99286353&numserie=1&2025&fecha=01-01-2026&importe=100.00",
"qr": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
}
Errores
| Código de error | Significado |
|---|---|
400 |
Bad RequestLa petición no es correcta, revisa los parametros que nos has enviado y sus valores |
403 |
ForbiddenNo tienes permisos para ejecutar la petición que has hecho. |
404 |
Not FoundNo podemos encontrar el recurso que nos has pedido. |
429 |
Too many requestHas excedido el numero de peticiones por bloque permitidas, deberas esperar hasta que se renueven. |
500 |
Internal Server ErrorParece que algo ha ido mal en el servidor, estamos en ello. |