Central do Desenvolvedor

Documentação do Desenvolvedor

A central do desenvolvedor é um repositório com referências técnicas, conceitos e materiais passo a passo sobre o funcionamento e comunicação através de API.

Suggest Edits

Introdução da API

 

A iugu disponibiliza uma interface de programação web, no modelo REST, disponível em um endereço de web. Por meio desta interface é possível conversar com o sistema de iugu, comandando ações, verificando configurações e sincronizando com seu sistemas.

O endereço base de comunicação é api.iugu.com, sempre com o protocolo seguro https. Além disto, agrupamos a versão por diretório.

Endereço para comunicação / Endpoint API

Este documento trata da versão da API 1.0.

O endereço para se comunicar através desta versão é:
https://api.iugu.com/v1/

Exemplos da utilização prática das chamadas de nossa API podem ser conferidas na seção de conceitos técnicos.

Suggest Edits

Autenticação

 

A autenticação na iugu é feita através da utilização de uma chave de API. Esta chave serve para que o sistema identifique a sua conta, e concede permissões para que o sistema se comunique com a iugu em nome da conta em questão.

Há duas maneiras de se autenticar, sendo a primeira, e mais recomendada, utilizando HTTP Basic Auth. A outra maneira é enviar o API Token num parâmetro de nome api_token.

As chaves de API podem ser TEST (Teste) ou LIVE (Produção), sendo que cada chamada irá se comunicar com os respectivos ambientes e os dados também estarão disponíveis de forma isolada no painel, dependendo do modo que estiver ativado.

Toggle de Produção/Teste no painel

Este toggle não altera a comunicação da API e sim a visão e ações executadas exclusivamente através do painel.

Criando suas chaves de API (API Tokens)

Trate suas chaves de API como senhas

Não inclua sua chave de API publicamente em nenhum lugar do seu site ou javascript. Lembre-se que esta chave dá acesso total ao seus dados na iugu.

Para adicionar uma chave de API, acesse o endereço https://app.iugu.com e siga o tutorial abaixo

HTTP Basic Auth

Para gerar o header de autenticação HTTP básico deve-se seguir os seguintes passos:

  1. Utilizar em nome de usuário seu API token e utilizar senha em branco separados por um dois pontos (:), exemplo: 2fd7f47f8b96c44e300a60ce35cfe414:
  2. Codificar a string resultante como uma sequência de octetos
  3. Codificar a string resultante utilizando Base64
  4. Concatenar a string resultando com o sufixo Authorization: Basic
  5. Resultar com uma string final parecida com Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
  6. Enviar essa informação no Header da request

HTTP Basic Auth

Você pode aprender mais sobre HTTP Basic Auth em https://en.wikipedia.org/wiki/Basic_access_authentication

Parâmetro api_token

As requests permitem o envio de um parâmetro chamado api_token onde pode ser enviado o API Token gerado anteriormente em vez de utilizar o HTTP Basic Auth.

Boas práticas

Como boa prática é interessante não misturar o que são de fato parâmetros da request da autenticação da mesma. Portanto, recomendamos a utilização de HTTP Basic Auth.

Suggest Edits

Resposta em JSON ou XML

 

Afim de facilitar a interoperabilidade entre sistemas, todas as nossas chamadas de API podem responder no formato JSON ou XML, conforme a sua escolha, sendo que o padrão é retornar em JSON. Isto é, quando não é especificado um formato.

Como especificar o formato de resposta

Você tem duas formas de especificar o formato de resposta:

  1. Adicionar a extensão ".xml" ou ".json" no final dos endereços de API
  2. Enviar um Header HTTP contento o tipo de conteúdo que você espera. Sendo "Accept: application/json" para JSON e "Accept: application/xml" para XML.
Suggest Edits

Erros

A Iugu API utiliza os próprios Códigos de Status HTTP para indicar sucesso ou falha da chamada. Em geral os códigos iniciados com 2 indicam sucesso, os iniciados com 4 indicam erro (Ex: Falta de parâmetro obrigatório) e iniciados com 5 indicam erro interno nos servidores da Iugu.
Pode conter tanto uma string de erro como um hash contendo o atributo e seus erros.

 

Formato para erros nos status 400, 401 e 404

{
    "errors": "Unauthorized"
}

Formato para erros status 422

{
    "errors": {
        "due_date": [
            "should not be in the past"
        ]
    }
}

Erros mais comuns

Português
Inglês

não pode ficar em branco

can't be blank

não pode ficar vazio

can't be empty

deve ser maior que N

must be greater than N

deve ser maior ou igual a N

must be greater than or equal to N

não está incluído na lista

is not included in the list

não é válido

is invalid

deve ser menor que N

must be less than N

deve ser menor ou igual a N

must be less than or equal to N

não é um número

is not a number

não pode estar no passado

should not be in the past

Suggest Edits

Metadados

 
Suggest Edits

Paginação

Em nossas APIs de listagem, usamos dois parâmetros que possibilitam a paginação em sua aplicação.

 

São eles:

start: Determina quantos registros no início da sua listagem serão ignorados.
limit: Determina o máximo de registros que serão retornados.

Obs.: Esse parâmetros funcionam mesmo que não sejam chamados simultaneamente.

Veja abaixo dois exemplos distintos da chamada de API para listagem de faturas:

1) Sem parâmetros de paginação

curl --request GET \
  --url https://api.iugu.com/v1/invoices
{
    "facets": {
        "status": {
            "_type": "terms",
            "missing": 0,
            "total": 10,
            "other": 0,
            "terms": [
                {
                    "term": "paid",
                    "count": 5
                },
                {
                    "term": "pending",
                    "count": 5
                }
            ]
        }
    },
    "totalItems": 2,
    "items": [ 
      #Fatura1, #Fatura2, #Fatura3, #Fatura4, #Fatura5, #Fatura6, #Fatura7, #Fatura8, #Fatura9, #Fatura10
    ]
}

2) Com parâmetros de paginação

Página 1:

curl --request GET \
  --url 'https://api.iugu.com/v1/invoices?start=0&limit=5'
{
    "facets": {
        "status": {
            "_type": "terms",
            "missing": 0,
            "total": 10,
            "other": 0,
            "terms": [
                {
                    "term": "paid",
                    "count": 5
                },
                {
                    "term": "pending",
                    "count": 5
                }
            ]
        }
    },
    "totalItems": 2,
    "items": [ 
      #Fatura1, #Fatura2, #Fatura3, #Fatura4, #Fatura5
    ]
}

Página 2:

curl --request GET \
  --url 'https://api.iugu.com/v1/invoices?start=5&limit=5'
{
    "facets": {
        "status": {
            "_type": "terms",
            "missing": 0,
            "total": 10,
            "other": 0,
            "terms": [
                {
                    "term": "paid",
                    "count": 5
                },
                {
                    "term": "pending",
                    "count": 5
                }
            ]
        }
    },
    "totalItems": 2,
    "items": [ 
      #Fatura6, #Fatura7, #Fatura8, #Fatura9, #Fatura10
    ]
}
Suggest Edits

Criar Fatura

Cria uma Fatura para um Cliente (Podendo ser um objeto cliente ou apenas um e-mail).

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/invoices
curl --request POST \
  --url https://api.iugu.com/v1/invoices
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/invoices' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/invoices");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "0958D2AAD34049AB889583E26DFA0BF1",
    "due_date": "2017-11-30",
    "currency": "BRL",
    "discount_cents": null,
    "email": "teste@teste.com",
    "items_total_cents": 1000,
    "notification_url": null,
    "return_url": null,
    "status": "pending",
    "tax_cents": null,
    "updated_at": "2014-06-17T09:58:05-03:00",
    "total_cents": 1000,
    "paid_at": null,
    "commission_cents": null,
    "secure_id": "0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "secure_url": "http://iugu.com/invoices/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "customer_id": null,
    "user_id": null,
    "total": "R$ 10,00",
    "taxes_paid": "R$ 0,00",
    "commission": "R$ 0,00",
    "interest": null,
    "discount": null,
    "created_at": "17/06, 09:58 h",
    "refundable": null,
    "installments": null,
    "bank_slip": {
        "digitable_line": "00000000000000000000000000000000000000000000000",
        "barcode_data": "00000000000000000000000000000000000000000000",
        "barcode": "http://iugu.com/invoices/barcode/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c"
    },
    "items": [{
        "id": "11DA8B1662EC4C30BC4C78AEDC619145",
        "description": "Item Um",
        "price_cents": 1000,
        "quantity": 1,
        "created_at": "2014-06-17T09:58:05-03:00",
        "updated_at": "2014-06-17T09:58:05-03:00",
        "price": "R$ 10,00"
    }],
    "variables": [{
        "id": "A897DD8BB6B54AE18CA4C48684E72FB9",
        "variable": "payment_data.transaction_number",
        "value": "1111"
    }],
    "custom_variables": [],
    "logs": []
}
{
  "errors": [
    "items deveria ser um Array"
  ]
}
{
  "errors": {
    "due_date": [
      "não pode ficar em branco",
      "não pode estar mais que três anos a frente",
      "não pode estar no passado"
    ]
  }
}

Body Params

email
string
required

E-mail do cliente

cc_emails
string

Endereços de E-mail para cópia separados por ponto e vírgula.

due_date
date
required

Data do vencimento. (Formato: 'AAAA-MM-DD').

items
array of objects
required

Itens da fatura. "price_cents" valor mínimo 100.

description
quantity
price_cents
return_url
string

Cliente é redirecionado para essa URL após efetuar o pagamento da Fatura pela página de Fatura da Iugu

expired_url
string

Cliente é redirecionado para essa URL se a Fatura que estiver acessando estiver expirada

notification_url
string

URL chamada para todas as notificações de Fatura, assim como os webhooks (Gatilhos) são chamados

fines
boolean

Booleano para Habilitar ou Desabilitar multa por atraso de pagamento

late_payment_fine
int32

Determine a multa % a ser cobrada para pagamentos efetuados após a data de vencimento

per_day_interest
boolean

Booleano que determina se cobra ou não juros por dia de atraso. 1% ao mês pro rata.

discount_cents
int32

Valor dos Descontos em centavos

customer_id
string

ID do Cliente

ignore_due_email
boolean

Booleano que ignora o envio do e-mail de cobrança

subscription_id
string

Amarra esta Fatura com a Assinatura especificada. Esta fatura não causa alterações na assinatura vinculada.

payable_with
mixed type

Método de pagamento que será disponibilizado para esta Fatura ("all", "credit_card" ou "bank_slip"). Obs: Caso esta Fatura esteja atrelada à uma Assinatura, a prioridade é herdar o valor atribuído na Assinatura; caso esta esteja atribuído o valor 'all', o sistema considerará o 'payable_with' da Fatura; se não, o sistema considerará o 'payable_with' da Assinatura.

credits
int32

Caso tenha o 'subscription_id', pode-se enviar o número de créditos a adicionar nessa Assinatura baseada em créditos, quando a Fatura for paga.

logs
array of objects

Logs da Fatura

description
notes
custom_variables
array of objects

Variáveis Personalizadas

name
value
early_payment_discount
boolean

Ativa ou desativa o desconto por pagamento antecipado (Se enviado, substituirá a configuração atual da conta)

early_payment_discounts
array of objects

Quantidade de dias de antecedência para o pagamento receber o desconto (Se enviado, substituirá a configuração atual da conta)

days
percent
*atenção*
object

Informações do cliente abaixo "payer" são obrigatórias para a emissão de boletos registrados ou necessárias para seu sistema de antifraude.

 
payer
object
 
payer.cpf_cnpj
string

CPF ou CNPJ do Cliente

payer.name
string

Nome Completo (utilizado como sacado no boleto)

payer.phone_prefix
string

Prefixo do Telefone (Ex: 11 para São Paulo)

payer.phone
string

Telefone

payer.email
string

E-mail do Cliente

payer.address
object

Endereço do cliente

 
payer.address.zip_code
string

CEP

payer.address.street
string

Rua

payer.address.number
string

Número

payer.address.district
string

Bairro

payer.address.city
string

Cidade

payer.address.state
string

Estado (Ex: SP)

payer.address.country
string

País

payer.address.complement
string

Complemento

 
Suggest Edits

Capturar Fatura

Captura uma fatura com estado "Em Análise" / "in_analysis".

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/invoices/id/capture
curl --request POST \
  --url https://api.iugu.com/v1/invoices/id/capture
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/invoices/id/capture' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices/id/capture")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/invoices/id/capture");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices/id/capture"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "5A4CBC68F7A647ECADD59D4E1B4B0DDF",
    "due_date": "2015-04-07",
    "currency": "BRL",
    "discount_cents": null,
    "email": "email@email.com",
    "items_total_cents": 15000,
    "notification_url": null,
    "return_url": null,
    "status": "paid",
    "tax_cents": null,
    "updated_at": "2015-04-08T11:06:43-03:00",
    "total_cents": 15000,
    "paid_at": "2015-04-08T11:06:43-03:00",
    "taxes_paid_cents": 705,
    "paid_cents": 15000,
    "cc_emails": null,
    "financial_return_date": "2015-05-08",
    "payable_with": "all",
    "commission_cents": 0,
    "secure_id": "5a4cbc68-f7a6-47ec-add5-9d4e1b4b0ddf-1342",
    "secure_url": "http://iugu.com/invoices/5a4cbc68-f7a6-47ec-add5-9d4e1b4b0ddf-1342",
    "commission": "R$ 0,00",
    "customer_id": "8747577C7C044D38B837844C751D2DCA",
    "customer_ref": "Nome do Cliente",
    "customer_name": "Nome do Cliente",
    "financial_return_dates": [
        {
            "installment": 1,
            "return_date": "2015-05-08",
            "status": "pending"
        }
    ],
    "user_id": "B733FEEDF4774F3A8EA33BF3682D532F",
    "total": "R$ 150,00",
    "taxes_paid": "R$ 7,05",
    "fines_on_occurrence_day": "R$ 0,00",
    "total_on_occurrence_day": "R$ 150,00",
    "fines_on_occurrence_day_cents": 0,
    "total_on_occurrence_day_cents": 15000,
    "advance_fee": null,
    "paid": "R$ 150,00",
    "interest": null,
    "discount": null,
    "created_at": "07/04, 15:09 h",
    "refundable": true,
    "installments": "1",
    "transaction_number": 50019,
    "created_at_iso": "2015-04-07T15:09:56-03:00",
    "updated_at_iso": "2015-04-08T11:06:43-03:00",
    "bank_slip": null,
    "items": [
        {
            "id": "E0174FC31EB94E84A106F7A6F9AE2B6E",
            "description": "Item 1",
            "price_cents": 15000,
            "quantity": 1,
            "created_at": "2015-04-07T15:09:56-03:00",
            "updated_at": "2015-04-07T15:09:56-03:00",
            "price": "R$ 150,00"
        }
    ],
    "variables": [
        {
            "id": "A8C555AF7A6C43EFAF16C8AF26E20FDE",
            "variable": "payment_data.transaction_number",
            "value": "50019"
        }
    ],
    "custom_variables": [],
    "logs": []
}

Path Params

id
string
required

ID da Fatura

 
Suggest Edits

Reembolsar Fatura

Efetua o reembolso de uma Fatura. Somente alguns meios de pagamento permitem o reembolso, como por exemplo o Cartão de Crédito. Após o reembolso, a Fatura fica com o status de "reembolsada" / "refunded".

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/invoices/id/refund
curl --request POST \
  --url https://api.iugu.com/v1/invoices/id/refund
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/invoices/id/refund' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices/id/refund")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/invoices/id/refund");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices/id/refund"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "0958D2AAD34049AB889583E26DFA0BF1",
    "due_date": "2013-11-30",
    "currency": "BRL",
    "discount_cents": null,
    "email": "teste@teste.com",
    "items_total_cents": 1000,
    "notification_url": null,
    "return_url": null,
    "status": "refunded",
    "tax_cents": null,
    "updated_at": "2014-06-17T09:58:05-03:00",
    "total_cents": 1000,
    "paid_at": null,
    "commission_cents": 0,
    "secure_id": "0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "secure_url": "http://iugu.com/invoices/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "customer_id": null,
    "user_id": null,
    "total": "R$ 10,00",
    "taxes_paid": "R$ 0,00",
    "commission": "R$ 0,00",
    "interest": null,
    "discount": null,
    "created_at": "17/06, 09:58 h",
    "refundable": null,
    "installments": null,
    "bank_slip": {
        "digitable_line": "00000000000000000000000000000000000000000000000",
        "barcode_data": "00000000000000000000000000000000000000000000",
        "barcode": "http://iugu.com/invoices/barcode/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c"
    },
    "items": [{
        "id": "11DA8B1662EC4C30BC4C78AEDC619145",
        "description": "Item Um",
        "price_cents": 1000,
        "quantity": 1,
        "created_at": "2014-06-17T09:58:05-03:00",
        "updated_at": "2014-06-17T09:58:05-03:00",
        "price": "R$ 10,00"
    }],
    "variables": [{
        "id": "A897DD8BB6B54AE18CA4C48684E72FB9",
        "variable": "payment_data.transaction_number",
        "value": "1111"
    }],
    "custom_variables": [],
    "logs": []
}

Path Params

id
string
required

ID da Fatura

 
Suggest Edits

Cancelar Fatura

Cancela uma Fatura.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/invoices/id/cancel
curl --request PUT \
  --url https://api.iugu.com/v1/invoices/id/cancel
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/invoices/id/cancel' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices/id/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/invoices/id/cancel");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices/id/cancel"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "0958D2AAD34049AB889583E26DFA0BF1",
    "due_date": "2013-11-30",
    "currency": "BRL",
    "discount_cents": null,
    "email": "teste@teste.com",
    "items_total_cents": 1000,
    "notification_url": null,
    "return_url": null,
    "status": "canceled",
    "tax_cents": null,
    "updated_at": "2014-06-17T09:58:05-03:00",
    "total_cents": 1000,
    "paid_at": null,
    "commission_cents": null,
    "secure_id": "0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "secure_url": "http://iugu.com/invoices/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "customer_id": null,
    "user_id": null,
    "total": "R$ 10,00",
    "taxes_paid": "R$ 0,00",
    "commission": "R$ 0,00",
    "interest": null,
    "discount": null,
    "created_at": "17/06, 09:58 h",
    "refundable": null,
    "installments": null,
    "bank_slip": {
        "digitable_line": "00000000000000000000000000000000000000000000000",
        "barcode_data": "00000000000000000000000000000000000000000000",
        "barcode": "http://iugu.com/invoices/barcode/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c"
    },
    "items": [{
        "id": "11DA8B1662EC4C30BC4C78AEDC619145",
        "description": "Item Um",
        "price_cents": 1000,
        "quantity": 1,
        "created_at": "2014-06-17T09:58:05-03:00",
        "updated_at": "2014-06-17T09:58:05-03:00",
        "price": "R$ 10,00"
    }],
    "variables": [{
        "id": "A897DD8BB6B54AE18CA4C48684E72FB9",
        "variable": "payment_data.transaction_number",
        "value": "1111"
    }],
    "custom_variables": [],
    "logs": []
}

Path Params

id
string
required

ID da Fatura

 
Suggest Edits

Remover Fatura

Remove uma Fatura permanentemente.

Cuidado

Apenas faturas com o status "canceled" podem ser removidas. Embora não seja recomendado a remoção permanente da fatura.

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/invoices/id
curl --request DELETE \
  --url https://api.iugu.com/v1/invoices/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/invoices/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/invoices/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "0958D2AAD34049AB889583E26DFA0BF1",
    "due_date": "2013-11-30",
    "currency": "BRL",
    "discount_cents": null,
    "email": "teste@teste.com",
    "items_total_cents": 1000,
    "notification_url": null,
    "return_url": null,
    "status": "pending",
    "tax_cents": null,
    "updated_at": "2014-06-17T09:58:05-03:00",
    "total_cents": 1000,
    "paid_at": null,
    "commission_cents": null,
    "secure_id": "0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "secure_url": "http://iugu.com/invoices/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "customer_id": null,
    "user_id": null,
    "total": "R$ 10,00",
    "taxes_paid": "R$ 0,00",
    "commission": "R$ 0,00",
    "interest": null,
    "discount": null,
    "created_at": "17/06, 09:58 h",
    "refundable": null,
    "installments": null,
    "bank_slip": {
        "digitable_line": "00000000000000000000000000000000000000000000000",
        "barcode_data": "00000000000000000000000000000000000000000000",
        "barcode": "http://iugu.com/invoices/barcode/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c"
    },
    "items": [{
        "id": "11DA8B1662EC4C30BC4C78AEDC619145",
        "description": "Item Um",
        "price_cents": 1000,
        "quantity": 1,
        "created_at": "2014-06-17T09:58:05-03:00",
        "updated_at": "2014-06-17T09:58:05-03:00",
        "price": "R$ 10,00"
    }],
    "variables": [{
        "id": "A897DD8BB6B54AE18CA4C48684E72FB9",
        "variable": "payment_data.transaction_number",
        "value": "1111"
    }],
    "custom_variables": [],
    "logs": []
}

Path Params

id
string
required

ID da Fatura

 
Suggest Edits

Gerar Segunda Via de Fatura

Gera segunda via de uma Fatura. Somente faturas pendentes podem ter segunda via gerada. A fatura atual é cancelada e uma nova é gerada com status "pendente" / "pending".

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/invoices/id/duplicate
curl --request POST \
  --url https://api.iugu.com/v1/invoices/id/duplicate
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/invoices/id/duplicate' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices/id/duplicate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/invoices/id/duplicate");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices/id/duplicate"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "856856F5ADA144F68DA6E5DBEF870434",
    "due_date": "2015-12-30",
    "currency": "BRL",
    "discount_cents": null,
    "email": "email@email.com",
    "items_total_cents": 6000,
    "notification_url": null,
    "return_url": null,
    "status": "pending",
    "tax_cents": null,
    "updated_at": "2015-11-26T10:41:19-02:00",
    "total_cents": 6000,
    "total_paid_cents": 0,
    "paid_at": null,
    "commission_cents": null,
    "taxes_paid_cents": null,
    "paid_cents": null,
    "cc_emails": null,
    "financial_return_date": null,
    "payable_with": "all",
    "overpaid_cents": null,
    "ignore_due_email": false,
    "ignore_canceled_email": null,
    "secure_id": "856856f5-ada1-44f6-8da6-e5dbef870434-fe5d",
    "secure_url": "https://iugu.com/invoices/856856f5-ada1-44f6-8da6-e5dbef870434-fe5d",
    "customer_id": null,
    "customer_ref": null,
    "customer_name": null,
    "user_id": null,
    "total": "R$ 60,00",
    "taxes_paid": "R$ 0,00",
    "total_paid": "R$ 0,00",
    "total_overpaid": "R$ 0,00",
    "fines_on_occurrence_day": null,
    "total_on_occurrence_day": null,
    "fines_on_occurrence_day_cents": null,
    "total_on_occurrence_day_cents": null,
    "advance_fee": null,
    "paid": "R$ 0,00",
    "commission": "R$ 0,00",
    "interest": null,
    "discount": null,
    "created_at": "26/11, 10:41 h",
    "refundable": null,
    "installments": null,
    "transaction_number": 50053,
    "payment_method": null,
    "created_at_iso": "2015-11-26T10:41:19-02:00",
    "updated_at_iso": "2015-11-26T10:41:19-02:00",
    "financial_return_dates": null,
    "bank_slip": {
        "digitable_line": "23793.38128 50000.005004 53000.050806 1 66580000006000",
        "barcode_data": "23791665800000060003381250000005005300005080",
        "barcode": "https://iugu.com/invoices/barcode/856856f5-ada1-44f6-8da6-e5dbef870434-fe5d"
    },
    "items": [
        {
            "id": "6FEE1E9B576D4D8DBB7A1CE5AFB5CFCC",
            "description": "Item Novo",
            "price_cents": 1000,
            "quantity": 1,
            "created_at": "2015-11-26T10:41:19-02:00",
            "updated_at": "2015-11-26T10:41:19-02:00",
            "price": "R$ 10,00"
        },
        {
            "id": "F6AB80CCA459434E980F59846C948B2C",
            "description": "Item 1",
            "price_cents": 5000,
            "quantity": 1,
            "created_at": "2015-11-26T10:41:19-02:00",
            "updated_at": "2015-11-26T10:41:19-02:00",
            "price": "R$ 50,00"
        }
    ],
    "variables": [
        {
            "id": "82139DD9E6704A369AEA0C7F50335EA9",
            "variable": "payment_data.transaction_number",
            "value": "1111"
        }
    ],
    "custom_variables": [],
    "logs": [
        {
            "id": "DF6A3748D2024E60A15189196264070A",
            "description": "Segunda via gerada",
            "notes": "Segunda via gerada da FATURA # 3062A45BC5C240C685C5D6A2B4C78668",
            "created_at": "26/11, 10:41 h"
        }
    ]
}

Path Params

id
string
required

ID da fatura

Body Params

due_date
date
required

Nova data de vencimento. (Formato: 'AAAA-MM-DD').

items
array of objects

Adicione, altere ou remova itens a nova fatura. "price_cents" valor mínimo 100.

description
quantity
price_cents
id
_destroy
ignore_due_email
boolean

Ignora o envio do e-mail de cobrança da nova fatura.

ignore_canceled_email
boolean

Ignora o envio do e-mail de cancelamento da fatura atual.

current_fines_option
boolean

Caso seja enviado 'true', as multas da fatura atual são aplicadas à segunda via.

 
Suggest Edits

Buscar Fatura

Retorna os dados de uma Fatura.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/invoices/id
curl --request GET \
  --url https://api.iugu.com/v1/invoices/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/invoices/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/invoices/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "0958D2AAD34049AB889583E26DFA0BF1",
    "due_date": "2013-11-30",
    "currency": "BRL",
    "discount_cents": null,
    "email": "teste@teste.com",
    "items_total_cents": 1000,
    "notification_url": null,
    "return_url": null,
    "status": "paid",
    "tax_cents": null,
    "updated_at": "2014-06-17T09:58:05-03:00",
    "total_cents": 1000,
    "paid_at": null,
    "commission_cents": null,
    "secure_id": "0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "secure_url": "http://iugu.com/invoices/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c",
    "customer_id": null,
    "user_id": null,
    "total": "R$ 10,00",
    "taxes_paid": "R$ 0,75",
    "financial_return_date": "2013-12-30",
    "commission": "R$ 0,00",
    "interest": null,
    "discount": null,
    "created_at": "17/06, 09:58 h",
    "refundable": null,
    "installments": null,
    "financial_return_dates": [
        {
            "id": 7,
            "installment": 1,
            "return_date": "2013-12-30",
             "status": "pending",
             "amount": "R$ 9,25",
             "taxes": "R$ 0,75"
        }
    ],
    "bank_slip": {
        "digitable_line": "00000000000000000000000000000000000000000000000",
        "barcode_data": "00000000000000000000000000000000000000000000",
        "barcode": "http://iugu.com/invoices/barcode/0958d2aa-d340-49ab-8895-83e26dfa0bf1-2f4c"
    },
    "items": [{
        "id": "11DA8B1662EC4C30BC4C78AEDC619145",
        "description": "Item Um",
        "price_cents": 1000,
        "quantity": 1,
        "created_at": "2014-06-17T09:58:05-03:00",
        "updated_at": "2014-06-17T09:58:05-03:00",
        "price": "R$ 10,00"
    }],
    "variables": [{
        "id": "A897DD8BB6B54AE18CA4C48684E72FB9",
        "variable": "payment_data.transaction_number",
        "value": "1111"
    },
    {
        "variable":"payment_data.occurrence_date",
        "value":"051017"
    },
    {
        "variable":"payment_method",
        "value":"iugu_credit_card_test"
    }
],
    "custom_variables": [],
    "logs": []
}

Path Params

id
string
required

ID da Fatura

 
Suggest Edits

Listar Faturas

Retorna uma lista com todas as faturas em sua conta ordenadas pela data de Criação, sendo a primeira a que foi criada mais recentemente. O campo "totalItems" contém sempre a quantidade de faturas cadastradas, independente dos parâmetros de pesquisa utilizados e o resultado da pesquisa fica sempre dentro de "items".

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/invoices
curl --request GET \
  --url https://api.iugu.com/v1/invoices
var request = require("request");

var options = { method: 'GET', url: 'https://api.iugu.com/v1/invoices' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/invoices")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/invoices");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/invoices"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "facets": {
        "status": {
            "_type": "terms",
            "missing": 0,
            "total": 2,
            "other": 0,
            "terms": [
                {
                    "term": "paid",
                    "count": 1
                },
                {
                    "term": "pending",
                    "count": 1
                }
            ]
        }
    },
    "totalItems": 2,
    "items": [
        {
            "id": "E607FCCD119E45C59336DB78B54CF771",
            "due_date": "2013-11-30",
            "currency": "BRL",
            "customer_id": null,
            "discount_cents": null,
            "email": "teste@teste.com",
            "expiration_url": null,
            "notification_url": null,
            "return_url": null,
            "status": "pending",
            "tax_cents": null,
            "updated_at": "2013-11-18T14:58:23-02:00",
            "total_cents": 1000,
            "commission_cents": null,
            "secure_id": "e607fccd-119e-45c5-9336-db78b54cf771-314d",
            "secure_url": "https://iugu.com/invoices/e607fccd-119e-45c5-9336-db78b54cf771-314d",
            "user_id": null,
            "commission": "R$ 0,00",
            "total": "R$ 10,00",
            "created_at": "18 Nov 14:58",
            "items": [
                {
                    "id": "0E9E83C2E8B14AF0ADB2F5F6E97265AA",
                    "description": "Item Um",
                    "price_cents": 1000,
                    "quantity": 1,
                    "created_at": "2013-11-18T14:58:23-02:00",
                    "updated_at": "2013-11-18T14:58:23-02:00",
                    "price": "R$ 10,00"
                }
            ],
            "variables": [],
            "logs": []
        },
        {
            "id": "F47FE578806747FE8FF71C1521934E81",
            "due_date": "2013-10-24",
            "currency": "BRL",
            "customer_id": "32ce45d8-b42b-4aee-a3d1-a1d9227e1790",
            "discount_cents": null,
            "email": "teste@gmail.com",
            "expiration_url": null,
            "notification_url": null,
            "return_url": null,
            "status": "paid",
            "tax_cents": null,
            "updated_at": "2013-10-24T14:21:26-02:00",
            "total_cents": 200,
            "commission_cents": 0,
            "secure_id": "f47fe578-8067-47fe-8ff7-1c1521934e81-3280",
            "secure_url": "https://iugu.com/invoices/f47fe578-8067-47fe-8ff7-1c1521934e81-3280",
            "commission": "R$ 0,00",
            "user_id": null,
            "total": "R$ 2,00",
            "created_at": "24 Oct 14:21",
            "items": [
                {
                    "id": "FBDBAF5E259C492C98E6C2CB493777F7",
                    "description": "Subscription Activation: plan1",
                    "price_cents": 200,
                    "quantity": 1,
                    "created_at": "2013-10-24T14:21:26-02:00",
                    "updated_at": "2013-10-24T14:21:26-02:00",
                    "price": "R$ 2,00"
                }
            ],
            "variables": [],
            "logs": []
        }
    ]
}

Query Params

limit
int32

Limita em até 1.000 o número de registros listados. Caso não seja enviado, aplica-se o limite padrão de 100 registros. Também utilizando em paginação.

start
int32

Quantos registros pular do início da pesquisa, usado para paginação.

created_at_from
date

Registros criados a partir dessa data passada no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

created_at_to
date

Registros criados até esta data passada no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

paid_at_from
date

Registros pagos a partir dessa data passada no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

paid_at_to
date

Registros pagos até esta data passada no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

due_date
date

Data de Expiração (AAAA/MM/DD)

query
string

Neste parâmetro pode ser passado um texto para pesquisa como e-mail, nome, anotações e variáveis customizadas

updated_since
date

Registros atualizados desde o momento passado no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

sortBy
object

Um hash sendo a chave o nome do campo para ordenação e o valor sendo DESC ou ASC para descendente e ascendente, respectivamente. ex1: sortBy[created_at_to]=ASC ex2: sortBy[due_date]=DESC

 
customer_id
string

ID do Cliente

status_filter
string

Filtrar pelo "status" das faturas (pending, paid, canceled, partially_paid, refunded, expired, authorized)

 
Suggest Edits

Tokenização e iugu.js

 

A maneira mais segura de criar tokens é através da biblioteca iugu.js, que garante a comunicação entre o navegador do usuário final diretamente com nossos servidores.

Saiba mais sobre o iugu.js e Tokenização.

Suggest Edits

Criar Token

O Token é uma representação do meio de pagamento do cliente (por ex: seu cartão de crédito), sendo totalmente seguro, de forma que não é possível que alguém consiga as informações do cartão de crédito do cliente utilizando esse token. O token é gerado para uma transação específica, tornando-o ainda mais seguro.

Cuidado

A API de Criação de Token não utiliza a autenticação via api_token.

Alerta de conformidade com PCI

Esta chamada API deve ser utilizada apenas em aplicações sem compatibilidade com JavaScript como por exemplo aplicações móveis. Se você efetuar esta chamada por dentro de seus servidores estará sujeito a uma auditoria do PCI. Para aplicações WEB, utilize a geração do token de cartão pelo iugu.js

 
posthttps://api.iugu.com/v1/payment_token
curl --request POST \
  --url https://api.iugu.com/v1/payment_token
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/payment_token' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/payment_token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/payment_token");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/payment_token"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "884629730509465AA89387529A56EE3C",
  "method": "credit_card",
  "extra_info": {
    "brand": "VISA",
    "holder_name": "JOHN DOE",
    "display_number": "XXXX-XXXX-XXXX-1111",
    "bin": "411111",
    "month": 10,
    "year": 2020
  },
  "test": true
}
{
  "errors": "account_id invalido"
}
{
  "errors": {
    "method": [
      "credit_cards não é suportado. (Métodos suportados: credit_card)"
    ], 
    "number": [
      "is not a valid credit card number"
    ], 
    "year": [
      "expired"
    ]
  }
}

Body Params

account_id
string
required

ID de sua Conta na Iugu (O ID de sua conta pode ser encontrado aqui)

method
string
required

Método de Pagamento (atualmente somente credit_card)

test
boolean

Valor true para criar tokens de teste. Use cartões de teste

data
object
 
data.number
string
required

Número do Cartão de Crédito

data.verification_value
string
required

CVV do Cartão de Crédito

data.first_name
string
required

Nome do Cliente como está no Cartão

data.last_name
string
required

Sobrenome do Cliente como está no Cartão

data.month
string
required

Mês de Vencimento no Formato MM (Ex: 01, 02, 12)

data.year
string
required

Mês de Vencimento no Formato MM (Ex: 01, 02, 12)

 
Suggest Edits

Cobrança Direta

Cobrança simples via boleto ou cartão de crédito.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/charge
curl --request POST \
  --url https://api.iugu.com/v1/charge
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/charge' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/charge")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/charge");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/charge"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

//credit_card return
{
  "message": "Autorizado",
  "errors": {},
  "success": true,
  "url": "https://faturas.iugu.com/03937a35-3208-4080-b551-f7307b581bd8-728a",
  "pdf": "https://faturas.iugu.com/03937a35-3208-4080-b551-f7307b581bd8-728a.pdf",
  "identification": null,
  "invoice_id": "03937A3532084080B551F7307B581BD8",
  "LR": "00"
}

//bank_slip return
{
  "success": true,
  "url": "https://faturas.iugu.com/8e312b31-4cca-471d-b6d5-e94febac1592-341a?bs=true",
  "pdf": "https://faturas.iugu.com/8e312b31-4cca-471d-b6d5-e94febac1592-341a.pdf",
  "identification": "00000000000000000000000000000000000000000000000",
  "invoice_id": "8E312B314CCA471DB6D5E94FEBAC1592"
}
//credit_cart return
{
  "errors": "token não é válido"
}

//bank_slip return
{
  "errors": "credit_cards não é suportado. (Métodos suportados: bank_slip)"
}
{
  "errors": {
    "total": [
      "deve ser maior que 1" /* "price_cents" deve ser maior que 100 */
    ]
  }
}

//bank_slip return
{
  "errors": {
    "payer.cpf_cnpj": [
      "não pode ficar em branco"
    ],
    "payer.name": [
      "não pode ficar em branco"
    ],
    "payer.address.zip_code": [
      "não pode ficar em branco",
      "não é válido"
    ],
    "payer.address.number": [
      "não pode ficar em branco"
    ]
  }
}

Body Params

method
string

Método de Pagamento (Atualmente só suporta "bank_slip", que é boleto bancário. Não é preenchido se enviar parâmetro token)

token
string

ID do Token. Não é preenchido caso o método de pagamento seja "bank_slip". Em caso de Marketplace, é possível enviar um token criado pela conta mestre.

customer_payment_method_id
string

ID da Forma de Pagamento do Cliente. Em caso de Marketplace, é possível enviar um "customer_payment_method_id" de um Cliente criado pela conta mestre (não é preenchido caso Método de Pagamento seja "bank_slip" ou utilize "token")

restrict_payment_method
boolean

Restringe o método de pagamento a cartão de crédito, na criação da cobrança direta.

customer_id
string

ID do Cliente. Utilizado para vincular a Fatura a um Cliente

invoice_id
string

ID da Fatura a ser utilizada para pagamento

email
string

E-mail do Cliente (não é preenchido caso seja enviado um "invoice_id")

months
int32

Número de Parcelas (2 até 12), não é necessário passar 1. Não é preenchido caso o método de pagamento seja "bank_slip"

discount_cents
int32

Valor dos Descontos em centavos. Funciona apenas para Cobranças Diretas criadas com Itens.

bank_slip_extra_days
int32

Define o prazo em dias para o pagamento do boleto. Caso não seja enviado, aplica-se o prazo padrão de 3 dias corridos.

keep_dunning
boolean

Por padrão, a fatura é cancelada caso haja falha na cobrança, a não ser que este parâmetro seja enviado como "true". Obs: Funcionalidade disponível apenas para faturas criadas no momento da cobrança.

items
array of objects

Itens de cobrança da Fatura que será gerada. "price_cents" valor mínimo 100.

description
quantity
price_cents
*atenção*
object

Informações do cliente abaixo "payer" são obrigatórias para a emissão de boletos registrados ou necessárias para seu sistema de antifraude.

 
payer
object
 
payer.cpf_cnpj
string

CPF ou CNPJ

payer.name
string

Nome

payer.phone_prefix
string

Prefixo do número de telefone

payer.phone
string

Número de telefone

payer.email
string

E-mail

payer.address
object

Endereço do cliente

 
payer.address.street
string

Rua

payer.address.number
string

Número

payer.address.district
string

Bairro

payer.address.city
string

Cidade

payer.address.state
string

Estado

payer.address.zip_code
string

CEP

payer.address.complement
string

Complemento (opcional)

 
Suggest Edits

Criar Cliente

Cria um objeto cliente

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/customers
curl --request POST \
  --url https://api.iugu.com/v1/customers
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/customers' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/customers");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "77C2565F6F064A26ABED4255894224F0",
    "email": "email@email.com",
    "name": "Nome do Cliente",
    "notes": "Anotações Gerais",
    "created_at": "2013-11-18T14:58:30-02:00",
    "updated_at": "2013-11-18T14:58:30-02:00",
    "custom_variables":[]
}

Body Params

email
string
required

Email do cliente

name
string
required

Nome do cliente

notes
string

Notas

cpf_cnpj
string

CPF ou CNPJ do cliente. Obrigatório para emissão de boletos registrados.

cc_emails
string

Endereços de E-mail para cópia separados por vírgula

zip_code
string

CEP. Obrigatório para emissão de boletos registrados

number
int32

Número do endereço (obrigatório caso "zip_code" seja enviado).

street
string

Rua. Obrigatório caso CEP seja incompleto.

city
string

Cidade

state
string

Estado

district
string

Bairro. Obrigatório caso CEP seja incompleto.

complement
string

Complemento de endereço. Ponto de referência.

custom_variables
array of objects

Variáveis Personalizadas

name
value
 
Suggest Edits

Alterar Cliente

Alterar os dados de um Cliente. Quaisquer parâmetros não informados não serão alterados.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/customers/id
curl --request PUT \
  --url https://api.iugu.com/v1/customers/id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/customers/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/customers/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "77C2565F6F064A26ABED4255894224F0",
    "email": "email@email.com",
    "name": "Novo Nome do Cliente",
    "notes": "Novas Anotações Gerais",
    "created_at": "2013-11-18T14:58:30-02:00",
    "updated_at": "2013-11-18T14:58:30-02:00",
    "custom_variables":[]
}

Path Params

id
string
required

ID do cliente

Body Params

email
string

Email do cliente

name
string

Nome do cliente

notes
string

Notas

cpf_cnpj
string

CPF ou CNPJ do cliente

cc_emails
string

Endereços de E-mail para cópia separados por vírgula

zip_code
string

CEP

number
int32

Número do endereço (obrigatório caso zip_code seja enviado)

street
string

Rua

city
string

Cidade

state
string

Estado

district
string

Bairro

complement
string

Complemento de endereço. Ponto de referência.

default_payment_method_id
string

ID da Forma de Pagamento padrão do cliente. Enviar "null" para desvincular o cartão das cobranças automáticas.

custom_variables
array of objects

Variáveis Personalizadas

name
value
 
Suggest Edits

Remover Cliente

Remove permanentemente um cliente. Porém, não permite remover clientes com assinaturas ou faturas vinculadas.

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/customers/id
curl --request DELETE \
  --url https://api.iugu.com/v1/customers/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/customers/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/customers/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "77C2565F6F064A26ABED4255894224F0",
    "email": "email@email.com",
    "name": "Novo Nome do Cliente",
    "notes": "Novas Anotações Gerais",
    "created_at": "2013-11-18T14:58:30-02:00",
    "updated_at": "2013-11-18T14:58:30-02:00",
    "custom_variables":[]
}

Path Params

id
string
required

ID do cliente

 
Suggest Edits

Buscar Cliente

Retorna os dados de um cliente

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/customers/id
curl --request GET \
  --url https://api.iugu.com/v1/customers/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/customers/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/customers/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "77C2565F6F064A26ABED4255894224F0",
    "email": "email@email.com",
    "name": "Nome do Cliente",
    "notes": "Anotações Gerais",
    "created_at": "2013-11-18T14:58:30-02:00",
    "updated_at": "2013-11-18T14:58:30-02:00",
    "custom_variables":[]
}

Path Params

id
string
required

ID do cliente

 
Suggest Edits

Listar Clientes

Retorna uma lista com todos os clientes cadastrados em sua conta ordenados pela data de Criação, sendo o primeiro o que foi criado mais recentemente. O campo "totalItems" contém sempre a quantidade de clientes cadastrados, independente dos parâmetros de pesquisa utilizados e o resultado da pesquisa fica sempre dentro de "items".

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/customers
curl --request GET \
  --url https://api.iugu.com/v1/customers
var request = require("request");

var options = { method: 'GET', url: 'https://api.iugu.com/v1/customers' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/customers");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "totalItems": 5,
    "items": [
        {
            "id": "FF3149CE52CB4A789925F154B489BFDD",
            "email": "email@email.com",
            "name": "Nome do Cliente",
            "notes": "Anotações Gerais",
            "created_at": "2013-11-18T14:58:30-02:00",
            "updated_at": "2013-11-18T14:58:30-02:00"
        },
        {
            "id": "912FD57927FA43DEB0223C819E18DDFE",
            "email": "email@email.com",
            "name": "Nome do Cliente",
            "notes": "Anotações Gerais",
            "created_at": "2013-11-18T14:58:30-02:00",
            "updated_at": "2013-11-18T14:58:30-02:00"
        },
        {
            "id": "32CE45D8B42B4AEEA3D1A1D9227E1790",
            "email": "email@gmail.com",
            "name": null,
            "notes": null,
            "created_at": "2013-11-18T14:58:30-02:00",
            "updated_at": "2013-11-18T14:58:30-02:00"
        },
        {
            "id": "1AF1B6EC280149708773FED03EB407AA",
            "email": "teste@gmail.com",
            "name": null,
            "notes": null,
            "created_at": "2013-11-18T14:58:30-02:00",
            "updated_at": "2013-11-18T14:58:30-02:00"
        },
        {
            "id": "D65B556E19ED4173976421E84EE7B251",
            "email": "cliente@gmail.com",
            "name": null,
            "notes": null,
            "created_at": "2013-11-18T14:58:30-02:00",
            "updated_at": "2013-11-18T14:58:30-02:00"
        }
    ]
}

Query Params

limit
int32

Limita em até 1.000 o número de registros listados. Caso não seja enviado, aplica-se o limite padrão de 100 registros. Também utilizando em paginação.

start
int32

Quantos registros pular do início da pesquisa.

created_at_from
date

Registros criados a partir desta data passada no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

created_at_to
date

Registros criados até esta data passada no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

query
string

Neste parâmetro pode ser passado um texto para pesquisa como e-mail, nome, anotações e variáveis customizadas

updated_since
date

Registros atualizados desde o valor passado no parâmetro. Formato (AAAA-MM-DDThh:mm:ss-03:00)

sortBy
object

Um hash sendo a chave o nome do campo para ordenação e o valor sendo DESC ou ASC para descendente e ascendente, respectivamente. ex1: sortBy[created_at_to]=ASC ex2: sortBy[updated_since]=DESC

 
 
Suggest Edits

Criar Forma de Pagamento

Cria uma Forma de Pagamento de Cliente.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/customers/customer_id/payment_methods
curl --request POST \
  --url https://api.iugu.com/v1/customers/customer_id/payment_methods
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/customers/customer_id/payment_methods' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/customer_id/payment_methods")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/customers/customer_id/payment_methods");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/customer_id/payment_methods"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "9B41FB19CBA44913B1EF990A10382E7E",
    "description": "Meu Cartão de Crédito",
    "item_type": "credit_card",
    "data": {
        "holder_name": "Joao Silva",
        "display_number": "XXXX-XXXX-XXXX-1111",
        "brand": "visa",
        "month":12,
        "year":2022
    }
}

Path Params

customer_id
string
required

ID do Cliente

Body Params

description
string
required

Descrição

token
string

Token de Pagamento criar

set_as_default
boolean

Define esta Forma de Pagamento como padrão do Cliente

 
Suggest Edits

Alterar Forma de Pagamento

Altera os dados de uma Forma de Pagamento, quaisquer parâmetros não informados não serão alterados.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/customers/customer_id/payment_methods/id
curl --request PUT \
  --url https://api.iugu.com/v1/customers/customer_id/payment_methods/id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/customers/customer_id/payment_methods/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/customer_id/payment_methods/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/customers/customer_id/payment_methods/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/customer_id/payment_methods/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "9B41FB19CBA44913B1EF990A10382E7E",
    "description": "Novo Meu Cartão de Crédito",
    "item_type": "credit_card",
    "data": {
        "holder_name": "Joao Silva",
        "display_number": "XXXX-XXXX-XXXX-1111",
        "brand": "visa",
        "month":10,
        "year":2022
    }
}

Path Params

customer_id
string
required

ID do cliente

id
string
required

ID da forma de pagamento

Body Params

description
string

Descrição

 
Suggest Edits

Remover Forma de Pagamento

Remove permanentemente uma forma de pagamento de um cliente.

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/customers/customer_id/payment_methods/id
curl --request DELETE \
  --url https://api.iugu.com/v1/customers/customer_id/payment_methods/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/customers/customer_id/payment_methods/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/customer_id/payment_methods/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/customers/customer_id/payment_methods/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/customer_id/payment_methods/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "9B41FB19CBA44913B1EF990A10382E7E",
    "description": "Novo Meu Cartão de Crédito",
    "item_type": "credit_card",
    "data": {
        "holder_name": "Joao Silva",
        "display_number": "XXXX-XXXX-XXXX-1111",
        "brand": "visa",
        "month":10,
        "year":2022
    }
}

Path Params

customer_id
string
required

ID do cliente

id
string
required

ID da forma de pagamento

 
Suggest Edits

Buscar Forma de Pagamento

Retorna os dados de uma Forma de Pagamento de um Cliente

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/customers/customer_id/payment_methods/id
curl --request GET \
  --url https://api.iugu.com/v1/customers/customer_id/payment_methods/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/customers/customer_id/payment_methods/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/customer_id/payment_methods/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/customers/customer_id/payment_methods/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/customer_id/payment_methods/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "9B41FB19CBA44913B1EF990A10382E7E",
    "description": "Meu Cartão de Crédito",
    "item_type": "credit_card",
    "data": {
        "holder_name": "Joao Silva",
        "display_number": "XXXX-XXXX-XXXX-1111",
        "brand": "visa",
        "month":10,
        "year":2022
    }
}

Path Params

customer_id
string
required

ID do cliente

id
string
required

ID da forma de pagamento

 
Suggest Edits

Listar Formas de Pagamento

Retorna uma lista com todas as formas de pagamento de determinado cliente.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/customers/customer_id/payment_methods
curl --request GET \
  --url https://api.iugu.com/v1/customers/customer_id/payment_methods
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/customers/customer_id/payment_methods' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/customers/customer_id/payment_methods")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/customers/customer_id/payment_methods");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/customers/customer_id/payment_methods"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[{
    "id": "48D603C05F634244A1D3FC2BFF35D10A",
    "description": "Meu Cartão de Crédito Um",
    "item_type": "credit_card",
    "data": {
        "holder_name": "Joao Silva",
        "display_number": "XXXX-XXXX-XXXX-1111",
        "brand": "visa",
        "month":10,
        "year":2022
    }
}, {
    "id": "9B41FB19CBA44913B1EF990A10382E7E",
    "description": "Meu Cartão de Crédito Dois",
    "item_type": "credit_card",
    "data": {
        "holder_name": "Jose Santos",
        "display_number": "XXXX-XXXX-XXXX-1111",
        "brand": "visa",
        "month":7,
        "year":2019
    }
}]

Path Params

customer_id
string
required

ID do cliente

 
Suggest Edits

Criar Plano

Cria um plano.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/plans
curl --request POST \
  --url https://api.iugu.com/v1/plans
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/plans' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/plans");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/plans"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "593C92165AF44493B65DE17A216C76D6",
    "name": "Plano Básico",
    "identifier": "basic_plan",
    "interval": 1,
    "interval_type": "months",
    "created_at": "2014-04-23T17:14:15-03:00",
    "updated_at": "2014-04-23T17:14:15-03:00",
    "prices": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "currency": "BRL",
        "id": "F465EE77AC424DA2B075133C96FF10CA",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value_cents": 1000
    }],
    "features": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "id": "6101C66D06564E3DB834BCE235A587A6",
        "identifier": "users",
        "important": null,
        "name": "Número de Usuários",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "position": 1,
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value": 10
    }]
}

Body Params

name
string
required

Nome do plano

identifier
string
required

Identificador do plano

interval
int32
required

Ciclo do plano (Número inteiro maior que 0)

interval_type
string
required

Tipo de interval ("weeks" ou "months")

value_cents
int32
required

Preço do plano em centavos

payable_with
string

Método de pagamento que será disponibilizado para as faturas pertencentes a assinaturas deste plano ('all', 'credit_card' ou 'bank_slip')

features
array of objects
name
identifier
value
 
Suggest Edits

Alterar Plano

Altera os dados de um Plano, quaisquer parâmetros não informados não serão alterados. As alterações não irão mudar as Assinaturas que já utilizam o Plano, mas só as novas.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/plans/id
curl --request PUT \
  --url https://api.iugu.com/v1/plans/id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/plans/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/plans/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/plans/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/plans/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "593C92165AF44493B65DE17A216C76D6",
    "name": "Plano Básico",
    "identifier": "basic_plan_new",
    "interval": 1,
    "interval_type": "months",
    "created_at": "2014-04-23T17:14:15-03:00",
    "updated_at": "2014-04-23T17:14:15-03:00",
    "prices": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "currency": "BRL",
        "id": "F465EE77AC424DA2B075133C96FF10CA",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value_cents": 1000
    }],
    "features": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "id": "6101C66D06564E3DB834BCE235A587A6",
        "identifier": "users",
        "important": null,
        "name": "Número de Usuários",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "position": 1,
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value": 10
    }]
}

Path Params

id
string
required

ID do plano

Body Params

name
string

Nome do plano

identifier
string

Identificador do plano

interval
int32

Ciclo do plano (Número inteiro maior que 0)

interval_type
string

Tipo de interval ("weeks" ou "months")

value_cents
int32

Preço do plano em centavos

payable_with
string

Método de pagamento que será disponibilizado para as faturas pertencentes a assinaturas deste plano ('all', 'credit_card' ou 'bank_slip')

features
array of objects
name
identifier
value
 
Suggest Edits

Remover Plano

Retorna os dados de um Plano.

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/plans/id
curl --request DELETE \
  --url https://api.iugu.com/v1/plans/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/plans/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/plans/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/plans/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/plans/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "593C92165AF44493B65DE17A216C76D6",
    "name": "Plano Básico",
    "identifier": "basic_plan",
    "interval": 1,
    "interval_type": "months",
    "created_at": "2014-04-23T17:14:15-03:00",
    "updated_at": "2014-04-23T17:14:15-03:00",
    "prices": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "currency": "BRL",
        "id": "F465EE77AC424DA2B075133C96FF10CA",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value_cents": 1000
    }],
    "features": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "id": "6101C66D06564E3DB834BCE235A587A6",
        "identifier": "users",
        "important": null,
        "name": "Número de Usuários",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "position": 1,
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value": 10
    }]
}

Path Params

id
string
required

ID do plano

 
Suggest Edits

Buscar Plano

Retorna os dados de um Plano.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/plans/id
curl --request GET \
  --url https://api.iugu.com/v1/plans/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/plans/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/plans/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/plans/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/plans/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "593C92165AF44493B65DE17A216C76D6",
    "name": "Plano Básico",
    "identifier": "basic_plan",
    "interval": 1,
    "interval_type": "months",
    "created_at": "2014-04-23T17:14:15-03:00",
    "updated_at": "2014-04-23T17:14:15-03:00",
    "prices": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "currency": "BRL",
        "id": "F465EE77AC424DA2B075133C96FF10CA",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value_cents": 1000
    }],
    "features": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "id": "6101C66D06564E3DB834BCE235A587A6",
        "identifier": "users",
        "important": null,
        "name": "Número de Usuários",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "position": 1,
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value": 10
    }]
}

Path Params

id
string
required

ID do plano

 
Suggest Edits

Buscar Plano pelo Identificador

Retorna os dados de um plano utilizando um identificador.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/plans/identifier/identifier
curl --request GET \
  --url https://api.iugu.com/v1/plans/identifier/identifier
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/plans/identifier/identifier' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/plans/identifier/identifier")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/plans/identifier/identifier");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/plans/identifier/identifier"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "593C92165AF44493B65DE17A216C76D6",
    "name": "Plano Básico",
    "identifier": "basic_plan",
    "interval": 1,
    "interval_type": "months",
    "created_at": "2014-04-23T17:14:15-03:00",
    "updated_at": "2014-04-23T17:14:15-03:00",
    "prices": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "currency": "BRL",
        "id": "F465EE77AC424DA2B075133C96FF10CA",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value_cents": 1000
    }],
    "features": [{
        "created_at": "2014-04-23T17:14:15-03:00",
        "id": "6101C66D06564E3DB834BCE235A587A6",
        "identifier": "users",
        "important": null,
        "name": "Número de Usuários",
        "plan_id": "593C92165AF44493B65DE17A216C76D6",
        "position": 1,
        "updated_at": "2014-04-23T17:14:15-03:00",
        "value": 10
    }]
}

Path Params

identifier
string
required

Identificador do plano

 
Suggest Edits

Listar Planos

Retorna uma lista com todos os planos em sua conta ordenadas pela data de Criação, sendo o primeiro o criado mais recentemente. O campo totalItems contém sempre a quantidade de planos cadastrados, independente dos parâmetros de pesquisa utilizados e o resultado da pesquisa fica sempre dentro de items.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/plans
curl --request GET \
  --url https://api.iugu.com/v1/plans
var request = require("request");

var options = { method: 'GET', url: 'https://api.iugu.com/v1/plans' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/plans");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/plans"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "totalItems": 1,
    "items": [{
        "id": "593C92165AF44493B65DE17A216C76D6",
        "name": "Plano Básico",
        "identifier": "basic_plan",
        "interval": 1,
        "interval_type": "months",
        "created_at": "2014-04-23T17:14:15-03:00",
        "updated_at": "2014-04-23T17:19:46-03:00",
        "prices": [{
            "created_at": "2014-04-23T17:14:15-03:00",
            "currency": "BRL",
            "id": "F465EE77AC424DA2B075133C96FF10CA",
            "updated_at": "2014-04-23T17:14:15-03:00",
            "value_cents": 1000
        }]
    }]
}

Query Params

limit
int32

Limita em até 1.000 o número de registros listados. Caso não seja enviado, aplica-se o limite padrão de 100 registros

start
int32

Quantos registros pular do início da pesquisa (muito utilizado para paginação)

query
string

Neste parâmetro pode ser passado um texto para pesquisa

updated_since
date

Registros atualizados desde o valor passado no parâmetro

sortBy
object

Um hash sendo a chave o nome do campo para ordenação e o valor sendo DESC ou ASC para descendente e ascendente, respectivamente. ex1: sortBy[updated_since]=ASC

 
 
Suggest Edits

Criar Assinatura

Cria uma Assinatura.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/subscriptions
curl --request POST \
  --url https://api.iugu.com/v1/subscriptions
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/subscriptions' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/subscriptions");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": false,
    "plan_identifier": "id1",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 0
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Body Params

plan_identifier
string

Identificador do Plano. Só é enviado para assinaturas que não são credits_based

customer_id
string
required

ID do Cliente

expires_at
date

Data de Expiração (Também é a data da próxima cobrança)

only_on_charge_success
boolean

Apenas Cria a Assinatura se a Cobrança for bem sucedida. Isso só funciona caso o cliente já tenha uma forma de pagamento padrão cadastrada. Não enviar "expires_at".

payable_with
string

Método de pagamento que será disponibilizado para as Faturas desta Assinatura (all, credit_card ou bank_slip). Obs: Dependendo do valor, este atributo será herdado, pois a prioridade é herdar o valor atribuído ao Plano desta Assinatura; caso este esteja atribuído o valor ‘all’, o sistema considerará o payable_with da Assinatura; se não, o sistema considerará o payable_with do Plano

credits_based
boolean

É uma assinatura baseada em créditos? booleano

price_cents
int32

Preço em centavos da recarga para assinaturas baseadas em crédito

credits_cycle
int32

Quantidade de créditos adicionados a cada ciclo, só enviado para assinaturas credits_based

credits_min
int32

Quantidade de créditos que ativa o ciclo, por ex: Efetuar cobrança cada vez que a assinatura tenha apenas 1 crédito sobrando. Esse 1 crédito é o credits_min

subitems
array of objects

Adiciona itens de cobrança a mais na assinatura do cliente. "price_cents" valor mínimo 100.

description
price_cents
quantity
recurrent
custom_variables
array of objects

Variáveis Personalizadas

name
value
 
Suggest Edits

Ativar Assinatura

Ativa uma Assinatura. Uma Fatura poderá ser gerada para o cliente.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/subscriptions/id/activate
curl --request POST \
  --url https://api.iugu.com/v1/subscriptions/id/activate
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/subscriptions/id/activate' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id/activate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/subscriptions/id/activate");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id/activate"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": false,
    "plan_identifier": "id1",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 0
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

ID da Assinatura

 
Suggest Edits

Suspender Assinatura

Suspende uma Assinatura.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/subscriptions/id/suspend
curl --request POST \
  --url https://api.iugu.com/v1/subscriptions/id/suspend
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/subscriptions/id/suspend' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id/suspend")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/subscriptions/id/suspend");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id/suspend"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": true,
    "plan_identifier": "id1",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 0
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

ID da Assinatura

 
Suggest Edits

Alterar Assinatura

Altera os dados de uma Assinatura, quaisquer parâmetros não informados não serão alterados.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/subscriptions/id
curl --request PUT \
  --url https://api.iugu.com/v1/subscriptions/id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/subscriptions/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/subscriptions/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": true,
    "plan_identifier": "id1",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 0
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

Body Params

plan_identifier
string

Identificador do Plano. Só é enviado para assinaturas que não são credits_based

expires_at
date

Data de Expiração (Também é a data da próxima cobrança)

payable_with
string

Método de pagamento que será disponibilizado para as Faturas desta Assinatura (all, credit_card ou bank_slip). Obs: Dependendo do valor, este atributo será herdado, pois a prioridade é herdar o valor atribuído ao Plano desta Assinatura; caso este esteja atribuído o valor ‘all’, o sistema considerará o payable_with da Assinatura; se não, o sistema considerará o payable_with do Plano

credits_based
boolean

É uma assinatura baseada em créditos? booleano

price_cents
int32

Preço em centavos da recarga para assinaturas baseadas em crédito

credits_cycle
int32

Quantidade de créditos adicionados a cada ciclo, só enviado para assinaturas credits_based

credits_min
int32

Quantidade de créditos que ativa o ciclo, por ex: Efetuar cobrança cada vez que a assinatura tenha apenas 1 crédito sobrando. Esse 1 crédito é o credits_min

subitems
array of objects

Adiciona itens de cobrança a mais na assinatura do cliente. "price_cents" valor mínimo 100.

description
price_cents
quantity
recurrent
custom_variables
array of objects

Variáveis Personalizadas

name
value
suspended
boolean

Assinatura suspensa? booleano

skip_charge
boolean

Ignorar Cobrança? booleano

 
Suggest Edits

Simular Alteração de Plano de Assinatura

Simula a alteração de plano de uma assinatura.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/subscriptions/id/change_plan_simulation/plan_identifier
curl --request GET \
  --url https://api.iugu.com/v1/subscriptions/id/change_plan_simulation/plan_identifier
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/subscriptions/id/change_plan_simulation/plan_identifier' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id/change_plan_simulation/plan_identifier")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/subscriptions/id/change_plan_simulation/plan_identifier");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id/change_plan_simulation/plan_identifier"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "cost": 19990,
  "discount": 0,
  "cycles": 1,
  "expires_at": "2016-08-25",
  "new_plan": "id2",
  "old_plan": "id1"
}

Path Params

id
string
required

ID da Assinatura

plan_identifier
string
required

Identificador do Plano

 
Suggest Edits

Alterar Plano da Assinatura

Altera o Plano de uma Assinatura. Uma Fatura cobrando a mudança de plano poderá ser gerada para o cliente.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/subscriptions/id/change_plan/plan_identifier
curl --request POST \
  --url https://api.iugu.com/v1/subscriptions/id/change_plan/plan_identifier
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/subscriptions/id/change_plan/plan_identifier' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id/change_plan/plan_identifier")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/subscriptions/id/change_plan/plan_identifier");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id/change_plan/plan_identifier"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": false,
    "plan_identifier": "id2",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 10
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

ID da Assinatura

plan_identifier
string
required

Identificador do Plano

 
Suggest Edits

Adicionar Créditos a Assinatura

Adiciona créditos a uma assinatura.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/subscriptions/id/add_credits
curl --request PUT \
  --url https://api.iugu.com/v1/subscriptions/id/add_credits
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/subscriptions/id/add_credits' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id/add_credits")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/subscriptions/id/add_credits");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id/add_credits"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": false,
    "plan_identifier": "id2",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 10
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 10,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;", 
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

Body Params

quantity
int32

Quantidade de créditos a adicionar

 
Suggest Edits

Remover Créditos da Assinatura

Adiciona créditos a uma assinatura.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/subscriptions/id/remove_credits
curl --request PUT \
  --url https://api.iugu.com/v1/subscriptions/id/remove_credits
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.iugu.com/v1/subscriptions/id/remove_credits' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id/remove_credits")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/subscriptions/id/remove_credits");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id/remove_credits"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": false,
    "plan_identifier": "id2",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 10
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 5,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

Body Params

quantity
int32

Quantidade de créditos a adicionar

 
Suggest Edits

Remover Assinatura

Remove uma Assinatura permanentemente.

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/subscriptions/id
curl --request DELETE \
  --url https://api.iugu.com/v1/subscriptions/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/subscriptions/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/subscriptions/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": true,
    "plan_identifier": "id1",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 0
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

ID da Assinatura

 
Suggest Edits

Buscar Assinatura

Retorna os dados de uma Assinatura.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/subscriptions/id
curl --request GET \
  --url https://api.iugu.com/v1/subscriptions/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/subscriptions/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/subscriptions/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "ECF36F9AAF374D76A48646EDE8FE806D",
    "suspended": false,
    "plan_identifier": "id1",
    "price_cents": 200,
    "currency": "BRL",
    "features": {
        "feat": {
            "name": "Feature",
            "value": 0
        }
    },
    "expires_at": null,
    "created_at": "2013-11-19T11:24:29-02:00",
    "updated_at": "2013-11-19T11:24:43-02:00",
    "customer_name": "Nome do Cliente",
    "customer_email": "email@email.com",
    "cycled_at": null,
    "credits_min": 0,
    "credits_cycle": null,
    "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
    "plan_name": "plan1",
    "customer_ref": "Nome do Cliente",
    "plan_ref": "plan1",
    "active": true,
    "in_trial": null,
    "credits": 0,
    "credits_based": false,
    "recent_invoices": null,
    "subitems": [{
        "id": "6D518D88B33F48FEA8964D5573E220D3",
        "description": "Item um",
        "quantity": 1,
        "price_cents": 1000,
        "price": "R$ 10,00",
        "total": "R$ 10,00"
    }],
    "logs": [{
        "id": "477388CC4C024520B552641724A62970",
        "description": "Fatura criada",
        "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
        "created_at": "2013-11-19T11:24:43-02:00"
    }, {
        "id": "706436F169CE465B806163964A25400A",
        "description": "Assinatura Criada",
        "notes": "Assinatura Criada",
        "created_at": "2013-11-19T11:24:29-02:00"
    }],
    "custom_variables":[]
}

Path Params

id
string
required

ID da Assinatura

 
Suggest Edits

Listar Assinaturas

Retorna uma lista com todas as assinaturas em sua conta ordenadas pela data de Criação, sendo a primeira a que foi criada mais recentemente. O campo totalItems contém sempre a quantidade de assinaturas cadastradas, independente dos parâmetros de pesquisa utilizados e o resultado da pesquisa fica sempre dentro de items.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/subscriptions
curl --request GET \
  --url https://api.iugu.com/v1/subscriptions
var request = require("request");

var options = { method: 'GET', url: 'https://api.iugu.com/v1/subscriptions' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/subscriptions");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/subscriptions"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "facets": {
        "suspended": {
            "_type": "filter",
            "count": 1
        },
        "active": {
            "_type": "filter",
            "count": 1
        },
        "due": {
            "_type": "filter",
            "count": 1
        }
    },
    "totalItems": 3,
    "items": [{
        "id": "ECF36F9AAF374D76A48646EDE8FE806D",
        "suspended": false,
        "plan_identifier": "id2",
        "price_cents": 200,
        "currency": "BRL",
        "features": {
            "feat": {
                "name": "Feature",
                "value": 10
            }
        },
        "expires_at": null,
        "created_at": "2013-11-19T11:24:29-02:00",
        "updated_at": "2013-11-19T11:24:43-02:00",
        "customer_name": "Nome do Cliente",
        "customer_email": "email@email.com",
        "cycled_at": null,
        "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
        "plan_name": "plan1",
        "customer_ref": "Nome do Cliente",
        "plan_ref": "plan1",
        "active": true,
        "in_trial": null,
        "recent_invoices": null,
        "subitems": [{
            "id": "6D518D88B33F48FEA8964D5573E220D3",
            "description": "Item um",
            "quantity": 1,
            "price_cents": 1000,
            "price": "R$ 10,00",
            "total": "R$ 10,00"
        }],
        "logs": [{
            "id": "477388CC4C024520B552641724A62970",
            "description": "Fatura criada",
            "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
            "created_at": "2013-11-19T11:24:43-02:00"
        }, {
            "id": "706436F169CE465B806163964A25400A",
            "description": "Assinatura Criada",
            "notes": "Assinatura Criada",
            "created_at": "2013-11-19T11:24:29-02:00"
        }]
    }, {
        "id": "ECF36F9AAF374D76A48646EDE8FE806D",
        "suspended": false,
        "plan_identifier": "id2",
        "price_cents": 200,
        "currency": "BRL",
        "features": {
            "feat": {
                "name": "Feature",
                "value": 10
            }
        },
        "expires_at": null,
        "created_at": "2013-11-19T11:24:29-02:00",
        "updated_at": "2013-11-19T11:24:43-02:00",
        "customer_name": "Nome do Cliente",
        "customer_email": "email@email.com",
        "cycled_at": null,
        "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
        "plan_name": "plan1",
        "customer_ref": "Nome do Cliente",
        "plan_ref": "plan1",
        "active": true,
        "in_trial": null,
        "recent_invoices": null,
        "subitems": [{
            "id": "6D518D88B33F48FEA8964D5573E220D3",
            "description": "Item um",
            "quantity": 1,
            "price_cents": 1000,
            "price": "R$ 10,00",
            "total": "R$ 10,00"
        }],
        "logs": [{
            "id": "477388CC4C024520B552641724A62970",
            "description": "Fatura criada",
            "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
            "created_at": "2013-11-19T11:24:43-02:00"
        }, {
            "id": "706436F169CE465B806163964A25400A",
            "description": "Assinatura Criada",
            "notes": "Assinatura Criada",
            "created_at": "2013-11-19T11:24:29-02:00"
        }]
    }, {
        "id": "ECF36F9AAF374D76A48646EDE8FE806D",
        "suspended": false,
        "plan_identifier": "id2",
        "price_cents": 200,
        "currency": "BRL",
        "features": {
            "feat": {
                "name": "Feature",
                "value": 10
            }
        },
        "expires_at": null,
        "created_at": "2013-11-19T11:24:29-02:00",
        "updated_at": "2013-11-19T11:24:43-02:00",
        "customer_name": "Nome do Cliente",
        "customer_email": "email@email.com",
        "cycled_at": null,
        "customer_id": "FF3149CE52CB4A789925F154B489BFDD",
        "plan_name": "plan1",
        "customer_ref": "Nome do Cliente",
        "plan_ref": "plan1",
        "active": true,
        "in_trial": null,
        "recent_invoices": null,
        "subitems": [{
            "id": "6D518D88B33F48FEA8964D5573E220D3",
            "description": "Item um",
            "quantity": 1,
            "price_cents": 1000,
            "price": "R$ 10,00",
            "total": "R$ 10,00"
        }],
        "logs": [{
            "id": "477388CC4C024520B552641724A62970",
            "description": "Fatura criada",
            "notes": "Fatura criada 1x Ativação de Assinatura: plan1 = R$ 2,00;1x Item um = R$ 10,00;",
            "created_at": "2013-11-19T11:24:43-02:00"
        }, {
            "id": "706436F169CE465B806163964A25400A",
            "description": "Assinatura Criada",
            "notes": "Assinatura Criada",
            "created_at": "2013-11-19T11:24:29-02:00"
        }]
    }]
}

Query Params

limit
int32

Limita em até 1.000 o número de registros listados. Caso não seja enviado, aplica-se o limite padrão de 100 registros

start
int32

Quantos registros pular do início da pesquisa, utilizado para paginação

created_at_from
date

Registros criados a partir do momento passado no parâmetro

created_at_to
date

Registros criados até o momento passado no parâmetro

query
string

Texto para pesquisa

updated_since
date

Registros atualizados desde o momento passado no parâmetro

sortBy
object

Um hash sendo a chave o nome do campo para ordenação e o valor sendo DESC ou ASC para descendente e ascendente, respectivamente. ex1: sortBy[created_at_to]=ASC ex2: sortBy[created_at_to]=DESC

 
customer_id
string

ID do Cliente

status_filter[]
string

Filtrar pelo "status" das assinaturas (active, suspended, due)

 
Suggest Edits

Transferir Valor

Transfere um determinado valor de sua conta para a conta destino.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/transfers
curl --request POST \
  --url https://api.iugu.com/v1/transfers
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/transfers' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/transfers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/transfers");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/transfers"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "1234565F6F06412345ED425581234567",
    "created_at": "2013-11-19T11:24:29-02:00",
    "amount_cents": "1000",
    "amount_localized": "R$ 10,00",
    "receiver": {
      "id": "77C2565F6F064A26ABED4255894224F0",
      "name": "Nome da Conta" 
    },
    "custom_variables": [{
        "name": "nome_da_variavel",
        "value": "valor_da_variavel"
    }]
}

Body Params

receiver_id
string

Account ID da conta que irá receber o valor

amount_cents
int32

Valor a transferir em centavos

custom_variables
array of objects

Variáveis Personalizadas

name
value
 
Suggest Edits

Buscar Transferência

Retorna as informações de uma transferência de valores.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/transfers/id
curl --request GET \
  --url https://api.iugu.com/v1/transfers/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/transfers/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/transfers/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/transfers/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/transfers/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "1234565F6F06412345ED425581234567",
    "created_at": "2013-11-19T11:24:29-02:00",
    "amount_cents": "1000",
    "amount_localized": "R$ 10,00",
    "receiver": {
      "id": "77C2565F6F064A26ABED4255894224F0",
      "name": "Nome da Conta" 
    },
    "custom_variables": [{
        "name": "nome_da_variavel",
        "value": "valor_da_variavel"
    }]
}

Path Params

id
string
required

ID da transferência

 
Suggest Edits

Listar Transferências

Retorna uma lista com todas as transferências efetuadas.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/transfers
curl --request GET \
  --url https://api.iugu.com/v1/transfers
var request = require("request");

var options = { method: 'GET', url: 'https://api.iugu.com/v1/transfers' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/transfers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/transfers");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/transfers"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "sent": [
    {
      "id": "1234565F6F06412345ED425581234567",
      "created_at": "2013-11-19T11:24:29-02:00",
      "amount_cents": "1000",
      "amount_localized": "R$ 10,00",
      "receiver": {
        "id": "77C2565F6F064A26ABED4255894224F0",
        "name": "Nome da Conta"
      }
    }
  ],
  "received": [
    {
      "id": "1234565F6F06132345ED425581234567",
      "created_at": "2013-12-19T11:24:29-02:00",
      "amount_cents": "2000",
      "amount_localized": "R$ 20,00",
      "sender": {
        "id": "77C2565F6F0611111BED4255894224F0",
        "name": "Conta Teste"
      }
    }
  ]
}

Query Params

custom_variables_name
string

Filtra as transferências bancárias pelo nome da variável customizada

custom_variables_value
string

Filtra as transferências bancárias pelo valor da variável customizada

 
Suggest Edits

Criar Conta

Permite a criação das contas de pagamento (ou subcontas). Apenas para clientes com permissão de marketplace ou parceiro de negócios.

Cuidado

Salve os dados de retorno em seu banco de dados, principalmente a chave "user_token". Estas chaves são as chaves de "api_tokens" essenciais para autenticação das chamadas nas subcontas.

Cuidado

Contas de Pagamento "sub-contas" NÃO podem ser excluídas.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/marketplace/create_account
curl --request POST \
  --url https://api.iugu.com/v1/marketplace/create_account
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/marketplace/create_account' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/marketplace/create_account")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/marketplace/create_account");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/marketplace/create_account"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "account_id": "49196DF60BC64B6EB42DEC9C5D81C2CC",
    "name": "Subconta",
    "live_api_token": "8c018fa32cbae33a47f0ec27f2e84d8c",
    "test_api_token": "aef793f12f6c67b93a4d39a4f42b7e98",
    "user_token": "1015cd6f9ddc96a357403f994f907cfd"
}

Body Params

name
string

Nome da Conta. Caso não seja enviado, um valor padrão com o ID da conta é atribuído

commission_percent
string

Percentual de comissionamento enviado para a conta que gerencia o marketplace (Valor entre 0 e 70)

 
Suggest Edits

Enviar Verificação de Conta

Todas as contas devem ter sua documentação verificada antes de poder emitir faturas reais (porém permite criação de dados de teste). Essa API permite o envio da documentação da sub-conta criada.

Atenção

Essa API obriga a utilização do "user_api_token" na autenticação da chamada. Prazo de aprovação de um dia útil.

Cuidado

No envio da verificação, é solicitado escolher entre conta PF ou PJ "data.person_type".

Se "person_type=Pessoa Física" é OBRIGATÓRIO, informar o CPF válido E conta bancária Pessoa Física vinculada ao CPF cadastrado.
Se "person_type=Pessoa Jurídica" é OBRIGATÓRIO, informar o CNPJ válido E conta bancária Pessoa Jurídica vinculada ao CNPJ cadastrado.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/accounts/id/request_verification
curl --request POST \
  --url https://api.iugu.com/v1/accounts/id/request_verification
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/accounts/id/request_verification' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/accounts/id/request_verification")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/accounts/id/request_verification");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/accounts/id/request_verification"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "EC696038CCCE456893568C886AEBFD4F",
    "data": {
        "price_range": "Subconta",
        "physical_products": "false",
        "business_type": "Serviços de Limpeza",
        "person_type": "Pessoa Física",
        "automatic_transfer": "true",
        "cpf": "123.123.123-12",
        "name": "Nome da Pessoa",
        "address": "Av. Paulista 320 cj 10",
        "cep": "01419-000",
        "city": "São Paulo",
        "state": "São Paulo",
        "telephone": "11-91231-1234",
        "bank": "Itaú",
        "bank_ag": "1234",
        "account_type": "Corrente",
        "bank_cc": "11231-2",
        "document_id": 1,
        "document_cpf": 2,
        "document_activity": 3
    },
    "account_id": "49196DF60BC64B6EB42DEC9C5D81C2CC",
    "created_at": "2014-03-14T11:12:18-03:00"
}

Path Params

id
string
required

ID da sub-conta

Body Params

automatic_validation
boolean

'true' para validar os dados bancários através do dígito verificador

data
object
 
data.price_range
string
required

Valor máximo da venda ('Até R$ 100,00', 'Entre R$ 100,00 e R$ 500,00', 'Mais que R$ 500,00')

data.physical_products
boolean
required

Vende produtos físicos?

data.business_type
string
required

Descrição do negócio

data.person_type
string
required

'Pessoa Física' ou 'Pessoa Jurídica'

data.automatic_transfer
boolean
required

Saque automático (Recomendamos que envie 'true')

data.cnpj
string

CNPJ caso Pessoa Jurídica

data.cpf
string

CPF caso Pessoa Física

data.company_name
string

Nome da Empresa, caso Pessoa Jurídica

data.name
string

Nome caso Pessoa Física

data.address
string
required

Endereço

data.cep
string
required

CEP

data.city
string
required

Cidade

data.state
string
required

Estado

data.telphone
string
required

Telefone

data.resp_name
string
required

Nome do Responsável, caso Pessoa Jurídica

data.resp_cpf
string
required

CPF do Responsável, caso Pessoa Jurídica

data.bank
string
required

'Itaú', 'Bradesco', 'Caixa Econômica', 'Banco do Brasil', 'Santander'

data.bank_ag
string
required

Agência da Conta

data.account_type
string
required

'Corrente', 'Poupança'

data.bank_cc
string
required

Número da Conta

files
object

Documentos para Verificação.

 
files.id
file

Multipart do Documento (RG, CPF)

files.cpf
file

Multipart do CPF (Caso não tenha CPF no id)

files.activity
file

Multipart de um documento que comprove a atividade exercida pela empresa/pessoa da conta

 

Formatação dos campos com automatic_validation

Banco Agência Conta
Banco do Brasil 9999-D 99999999-D
Santander 9999 99999999-D
Caixa Econômica 9999 99999999-D
Bradesco 9999-D 9999999-D
Itaú 9999 99999-D
Suggest Edits

Informações da Conta

Retorna as informações de uma conta. Use o LIVE_API_TOKEN da sub-conta na autenticação.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/accounts/id
curl --request GET \
  --url https://api.iugu.com/v1/accounts/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/accounts/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/accounts/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/accounts/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/accounts/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "49196DF60BC64B6EB42DEC9C5D81C2CC",
    "name": "Subconta",
    "created_at": "2014-03-14T07:57:24-03:00",
    "updated_at": "2014-03-14T07:57:25-03:00",
    "can_receive?": false,
    "is_verified?": false,
    "last_verification_request_status": "pending",
    "last_verification_request_data": {
        "price_range": "Subconta",
        "physical_products": "false",
        "business_type": "Serviços de Limpeza",
        "person_type": "Pessoa Física",
        "automatic_transfer": "true",
        "cpf": "123.123.123-12",
        "name": "Nome da Pessoa",
        "address": "Av. Paulista 320 cj 10",
        "cep": "01419-000",
        "city": "São Paulo",
        "state": "São Paulo",
        "telephone": "11-91231-1234",
        "bank": "Itaú",
        "bank_ag": "1234",
        "account_type": "Corrente",
        "bank_cc": "11231-2",
        "document_id": "1:ledermantel_art.png",
        "document_cpf": "2:ledermantel_art.png",
        "document_activity": "3:ledermantel_art.png"
    },
    "last_verification_request_feedback": null,
    "change_plan_type": 1,
    "subscriptions_trial_period": 0,
    "disable_emails": false,
    "last_withdraw": null,
    "total_subscriptions": 0,
    "reply_to": null,
    "webapp_on_test_mode": false,
    "marketplace": false,
    "auto_withdraw": false,
    "balance": "R$ 0,00",
    "balance_available_for_withdraw":"R$ 0,00",
    "balance_in_protest":"R$ 0,00",
    "protected_balance": "R$ 0,00",
    "payable_balance": "R$ 0,00",
    "receivable_balance": "R$ 0,00",
    "commission_balance": "R$ 0,00",
    "volume_last_month": "R$ 0,00",
    "volume_this_month": "R$ 0,00",
    "taxes_paid_last_month": "R$ 0,00",
    "taxes_paid_this_month": "R$ 0,00",
    "custom_logo_url": null,
    "custom_logo_small_url": null,
    "informations": [{
        "key": "commission_percent",
        "value": "10.0"
    }]
}

Path Params

id
string
required

ID da sub-conta

 
Suggest Edits

Configurar Conta

Configura parâmetros de uma conta de pagamentos.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/accounts/configuration
curl --request POST \
  --url https://api.iugu.com/v1/accounts/configuration
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/accounts/configuration' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/accounts/configuration")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/accounts/configuration");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/accounts/configuration"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "63C332E29A1B44B386991BF2A6B96D43",
    "name": "Conta Demo",
    "created_at": "2013-02-15T12:20:28-02:00",
    "updated_at": "2014-06-26T10:48:46-03:00",
    "can_receive?": true,
    "is_verified?": true,
    "last_verification_request_status": "accepted",
    "last_verification_request_data": null,
    "last_verification_request_feedback": null,
    "change_plan_type": 1,
    "subscriptions_trial_period": 0,
    "disable_emails": false,
    "last_withdraw": null,
    "total_subscriptions": 79,
    "reply_to": null,
    "webapp_on_test_mode": false,
    "marketplace": false,
    "default_return_url": "",
    "auto_withdraw": true,
    "balance": "R$ 0,00",
    "protected_balance": "R$ 0,00",
    "payable_balance": "R$ 0,00",
    "receivable_balance": "R$ 0,00",
    "commission_balance": "R$ 0,00",
    "volume_last_month": "R$ 804,20",
    "volume_this_month": "R$ 0,00",
    "taxes_paid_last_month": "R$ 46,57",
    "taxes_paid_this_month": "R$ 0,00",
    "custom_logo_url": null,
    "custom_logo_small_url": null,
    "informations": [{
        "key": "charge_limit",
        "value": "50000"
    }, {
        "key": "return_days",
        "value": "1"
    }, {
        "key": "account_type",
        "value": "Tipo da Conta"
    }, {
        "key": "bank",
        "value": "Banco"
    }, {
        "key": "commission_percent",
        "value": "1"
    }, {
        "key": "iugu_credit_card_percent_1",
        "value": "0.04"
    }, {
        "key": "automatic_transfer",
        "value": "true"
    }],
    "configuration": {
        "commission_percent": 1,
        "bank_slip": {
            "active": true,
            "extra_due": "1",
            "reprint_extra_due": "1"
        },
        "credit_card": {
            "active": true,
            "soft_descriptor": "TESTE",
            "installments": true,
            "installments_pass_interest": true,
            "max_installments": "12",
            "max_installments_without_interest": "2",
            "two_step_transaction": true
        }
    }
}

Body Params

commission_percent
string

Percentual de comissionamento enviado para a conta que gerencia o marketplace (Valor entre 0 e 70)

auto_withdraw
boolean

Saque automático?

fines
boolean

Multas?

per_day_interest
boolean

Juros de mora?

late_payment_fine
int32

Valor da multa em % (Ex: 2)

auto_advance
boolean

Antecipação Automática. Só pode ser atribuído caso a conta tenha a funcionalidade de Novo Adiantamento habilitado (entre em contato com o Suporte para habilitar)

auto_advance_type
string

Opções de Antecipação Automática. Obrigatório caso auto_advance seja true. Recebe os valores 'daily' (Antecipação diária), 'weekly' (Antecipação semanal, que ocorre no dia da semana determinado pelo usuário), 'monthly' (Antecipação mensal, que ocorre no dia do mês determinado pelo usuário) e 'days_after_payment' (Antecipação que ocorre em um número de dias após o pagamento especificado pelo usuário)

auto_advance_option
int32

Obrigatório caso auto_advance seja true e auto_advance_type diferente de 'daily'. Em caso de auto_advance_type = weekly, recebe valores de 0 a 6 (Número correspondente ao dia da semana que a antecipação será realizada, 0 para domingo, 1 para segunda e assim por diante). Em caso de auto_advance_type = monthly, recebe valores de 1 a 28 (Número correspondente ao dia do mês que a antecipação será realizada). Em caso de auto_advance_type = days_after_payment, recebe valores de 1 a 30 (Número de dias após o pagamento em que a antecipação será realizada)

bank_slip
object

Configurações de boleto bancário

 
bank_slip.active
boolean

Ativo?

bank_slip.extra_due
integer

Dias de Vencimento Extras no Boleto (Ex: 2)

bank_slip.reprint_extra_due
integer

Dias de Vencimento Extras na 2a Via do Boleto (Ex: 1)

credit_card
object

Configurações de cartão de crédito

 
credit_card.active
boolean

Ativo?

credit_card.soft_descriptor
string

Descrição que apareça na Fatura do Cartão do Cliente (Máx: 12 Caracteres)

credit_card.installments
boolean

Parcelamento ativo?

credit_card.max_installments
integer

Número máximo de parcelas (Nr entre 1 a 12)

credit_card.max_installments_without_interest
integer

Número de parcelas sem cobrança de juros ao cliente (Nr entre 1 a 12). *somente contas antigas

credit_card.two_step_transaction
boolean

Habilita o fluxo de pagamento em duas etapas (Autorização e Captura)

credit_card.installments_pass_interest
boolean

Repasse de Juros de Parcelamento ativo? *somente contas antigas

payment_email_notification
boolean

boolean Ativa ou desativa a notificação de pagamento

payment_email_notification_receiver
string

Email que deve receber as notificações de pagamento (Obrigatório caso payment_email_notification seja true)

early_payment_discount
boolean

Ativa ou desativa o desconto por pagamento antecipado

early_payment_discounts
array of objects

Configuração do desconto a ser aplicado

days
percent
 
Suggest Edits

Adicionar Domicílio Bancário

Envia dados para alterar domicílio bancário. Destino de valores ao transferir ou sacar dinheiro.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/bank_verification
curl --request POST \
  --url https://api.iugu.com/v1/bank_verification
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/bank_verification' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/bank_verification")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/bank_verification");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/bank_verification"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "success": true
}

Body Params

agency
string

Agência Bancária

account
string

Nr da Conta

account_type
string

Tipo da Conta ("cc" para Conta Corrente e "cp" para Conta Poupança)

bank
string

Nr do Banco ("001" para Banco do Brasil, "033" para Santander, "104" para Caixa Econômica, "237" para Bradesco, "341" para Itaú e "399" para HSBC

automatic_validation
boolean

'true' para validar os dados bancários através do dígito verificador

document
file

Documento de Comprovação dos Dados Bancários (Enviar via multipart ou base64)

 

Formatação dos campos com automatic_validation

Banco Agência Conta
Banco do Brasil 9999-D 99999999-D
Santander 9999 99999999-D
Caixa Econômica 9999 XXX99999999-D (X: Operação)
Bradesco 9999-D 9999999-D
Itaú 9999 99999-D
Suggest Edits

Verificar Envio de Domicilio Bancario

Consultar dados enviados para alterar domicílio bancário.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/bank_verification
curl --request GET \
  --url https://api.iugu.com/v1/bank_verification
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/bank_verification' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/bank_verification")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/bank_verification");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/bank_verification"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[
  {
    "id": "F7D999A13D17459991A77456F061C3E0",
    "status": "pending",
    "created_at":"2017-10-05T14:31:32-03:00",
    "updated_at":"2017-10-05T14:31:32-03:00",
    "account": "1234567-8",
    "agency": "4321-0",
    "operation": null,
    "feedback": null,
    "bank": "Bradesco"
  },
  {
    "id": "7F26B51BFC5A4C09B18DCAB6805141BE",
    "status": "rejected",
    "created_at":"2016-11-29T08:59:25-02:00",
    "updated_at":"2016-11-29T09:00:56-02:00",
    "account": "1234-5",
    "agency": "1234",
    "operation": null,
    "feedback": "Recusado, envio de teste",
    "bank": "Itaú"
  }
]
{
  "errors": "Not Found"
}
 
Suggest Edits

Pedido de Saque

Faz um pedido de Saque de um valor.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/accounts/id/request_withdraw
curl --request POST \
  --url https://api.iugu.com/v1/accounts/id/request_withdraw
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/accounts/id/request_withdraw' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/accounts/id/request_withdraw")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/accounts/id/request_withdraw");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/accounts/id/request_withdraw"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
    "id": "2B925E434B324F46827580F6BC0638AB",
    "amount": "500.0"
}

Path Params

id
string
required

ID da sub-conta

Body Params

amount
float

Valor do Saque (Formato: 500.0 para 500 reais)

custom_variables
array of objects

Variáveis personalizadas

name
value
 
Suggest Edits

Listar Contas

Lista as contas de um marketplace ou parceiro de negócios.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/marketplace
curl --request GET \
  --url https://api.iugu.com/v1/marketplace
var request = require("request");

var options = { method: 'GET', url: 'https://api.iugu.com/v1/marketplace' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/marketplace")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/marketplace");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/marketplace"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "totalItems": 2,
  "items": [
    {
      "id": "63EC0B8F0FA74B6589AA8B005FEF20FA",
      "name": "Nome da Subconta",
      "verified": true
    },
    {
      "id": "883F3B8F0FA749D3B1AA8B00093FF32F",
      "name": "Nome da Segunda Subconta",
      "verified": true
    }
  ]
}

Query Params

limit
int32

Limita em até 1.000 o número de registros listados. Caso não seja enviado, aplica-se o limite padrão de 100 registros

start
int32

Quantos registros pular do início da pesquisa

query
string

Neste parâmetro pode ser passado um texto para pesquisa

 
Suggest Edits

Renovar Api Token de Usuário

Renova o api token de usuário de uma conta

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/profile/renew_access_token
curl --request POST \
  --url https://api.iugu.com/v1/profile/renew_access_token
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/profile/renew_access_token' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/profile/renew_access_token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/profile/renew_access_token");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/profile/renew_access_token"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "locale": "pt-BR",
  "name": "José da Silva",
  "birthdate": "1985-10-11",
  "email": "test@iugu.com",
  "created_at": "2014-06-06T10:13:50-03:00"
}
{
  "errors": "Unauthorized"
}
 
Suggest Edits

Criar API Token

Cria um "api_token" em uma subconta.

Atenção

Essa API obriga a utilização do "user_api_token" na autenticação da chamada.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/account_id/api_tokens
curl --request POST \
  --url https://api.iugu.com/v1/account_id/api_tokens
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.iugu.com/v1/account_id/api_tokens' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/account_id/api_tokens")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/account_id/api_tokens");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/account_id/api_tokens"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "A0036E328D254004AEA7FD9FE808CDA5",
  "token": "048e378481b750ffbc3ab9e0c0fee11",
  "api_type": "TEST",
  "description": "Token de Teste",
  "created_at": "2017-06-28T13:31:04-03:00"
}
{
  "errors": [
    "Description não pode ficar em branco",
    "Api type não pode ficar em branco",
    "Api type tipo de api não suportado"
  ]
}

Path Params

account_id
string
required

ID da conta em que o token será criado

Body Params

api_type
string
required

Tipo de API. 'LIVE' para ambiente de produção e 'TEST' para ambiente de testes. "Case Sensitive"

description
string
required

Descrição

 
Suggest Edits

Remover API Token

Remove um "api_token" em uma subconta.

Atenção

Essa API obriga a utilização do "user_api_token" na autenticação da chamada.

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/account_id/api_tokens/id
curl --request DELETE \
  --url https://api.iugu.com/v1/account_id/api_tokens/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/account_id/api_tokens/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/account_id/api_tokens/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/account_id/api_tokens/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/account_id/api_tokens/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "47A426FA62C0411584988A495A445E5F",
  "token": "700057ef6329852fc87622d661e43653",
  "api_type": "LIVE",
  "description": "Token de produção",
  "created_at": "2017-06-28T13:34:16-03:00"
}
{
  "errors": "Api token Not Found"
}

Path Params

account_id
string
required

ID da conta em que o token será removido

id
string
required

ID do Token

 
Suggest Edits

Listar API Tokens

Listar os "api_tokens" em uma subconta.

Atenção

Essa API obriga a utilização do "user_api_token" na autenticação da chamada.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/account_id/api_tokens
curl --request GET \
  --url https://api.iugu.com/v1/account_id/api_tokens
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/account_id/api_tokens' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/account_id/api_tokens")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/account_id/api_tokens");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/account_id/api_tokens"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[
  {
    "id": "9314B461BE4846E59503E5C8FACC01BA",
    "token": "c3a2fa6f0ccb92f4ebb4f26c8f856ea",
    "api_type": "LIVE",
    "description": "Token de produção",
    "created_at": "2017-06-28T13:48:32-03:00"
  },
  {
    "id": "E736BD081CA04A10B152C3479D2EEA51",
    "token": "b0ee0ac4e6a9eb41465d435556b8822",
    "api_type": "TEST",
    "description": "Token de teste",
    "created_at": "2017-06-28T13:34:07-03:00"
  }
]

Path Params

account_id
string
required

ID da conta para listar seus tokens

 
Suggest Edits

Listar Eventos Disponíveis

Lista todos os eventos disponíveis para criação de um Gatilho

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/web_hooks/supported_events
curl --request GET \
  --url https://api.iugu.com/v1/web_hooks/supported_events
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/web_hooks/supported_events' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/web_hooks/supported_events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/web_hooks/supported_events");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/web_hooks/supported_events"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[
  "all",
  "invoice.created",
  "invoice.status_changed",
  "invoice.refund",
  "invoice.payment_failed",
  "invoice.dunning_action",
  "invoice.due",
  "invoice.installment_released",
  "invoice.released",
  "subscription.suspended",
  "subscription.activated",
  "subscription.created",
  "subscription.renewed",
  "subscription.expired",
  "subscription.changed",
  "referrals.verification",
  "referrals.bank_verification",
  "withdraw_request.created",
  "withdraw_request.status_changed"
]
 
Suggest Edits

Criar Gatilho

Cria gatilho

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.iugu.com/v1/web_hooks
curl --request POST \
  --url https://api.iugu.com/v1/web_hooks
var request = require("request");

var options = { method: 'POST', url: 'https://api.iugu.com/v1/web_hooks' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/web_hooks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.iugu.com/v1/web_hooks");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/web_hooks"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "D57FCEA0EB7A4647B05E1B562035D9CA",
  "url": "https://endpoint_gatilho.in/123",
  "authorization": "my_key",
  "event": "invoice.created"
}

Body Params

event
string
required

Nome do evento desejado

url
string
required

Endpoint para qual o gatilho será enviado

authorization
string

Grave uma chave / key para usar como "Basic Authentication" na validação do recebimento dos gatilhos.

 
Suggest Edits

Alterar Gatilho

Altera um gatilho

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.iugu.com/v1/web_hooks/id
curl --request PUT \
  --url https://api.iugu.com/v1/web_hooks/id
var request = require("request");

var options = { method: 'PUT', url: 'https://api.iugu.com/v1/web_hooks/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/web_hooks/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.iugu.com/v1/web_hooks/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/web_hooks/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "D57FCEA0EB7A4647B05E1B562035D9CA",
  "url": "https://endpoint_gatilho.in/123",
  "authorization": "my_key",
  "event": "invoice.status_changed"
}

Body Params

event
string

Nome do evento desejado

url
string

Endpoint para qual o gatilho será enviado

authorization
string

Grave uma chave / key para usar como "Basic Authentication" na validação do recebimento dos gatilhos.

 
Suggest Edits

Remover Gatilho

Remove um gatilho

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.iugu.com/v1/web_hooks/id
curl --request DELETE \
  --url https://api.iugu.com/v1/web_hooks/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.iugu.com/v1/web_hooks/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/web_hooks/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.iugu.com/v1/web_hooks/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/web_hooks/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "D57FCEA0EB7A4647B05E1B562035D9CA",
  "url": "https://endpoint_gatilho/12345",
  "authorization": null,
  "event": "invoice.status_changed"
}

Path Params

id
string
required

ID do Gatilho

 
Suggest Edits

Buscar Gatilho

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.iugu.com/v1/web_hooks/id
curl --request GET \
  --url https://api.iugu.com/v1/web_hooks/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.iugu.com/v1/web_hooks/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.iugu.com/v1/web_hooks/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.iugu.com/v1/web_hooks/id");

xhr.send(data);
import requests

url = "https://api.iugu.com/v1/web_hooks/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "id": "D57FCEA0EB7A4647B05E1B562035D9CA",
  "url": "https://endpoint_gatilho.in/12345",
  "authorization": "my_key",
  "event": "invoice.status_changed"
}

Path Params

id
string
required

ID do Gatilho