---
title: "Editar metadados da fatura"
url: "https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5/operations/editar-metadados-da-fatura-1"
---

> Full API specification: https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5.md

# Editar metadados da fatura

`PATCH` `/invoices/{invoice_id}/metadata`

Operation ID: `editar-metadados-da-fatura-1`

Com o verbo _HTTP PATCH_, através do identificador da fatura (`invoice_id`) é possível atualizar o objeto `metadata` da fatura.

## Path parameters

- `invoice_id` (string, required) - Código da fatura.<br>Formato: `in_XXXXXXXXXXXXXXXX`.

## Request body

Content types: `application/json`

## Responses

- `200` - 200
- `404` - 404

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Pagar.me v5 API (Legado)
  version: 5.0.0
servers:
  - url: https://api.stone.com.br/core/v5
paths:
  /invoices/{invoice_id}/metadata:
    patch:
      summary: Editar metadados da fatura
      description: Com o verbo _HTTP PATCH_, através do identificador da fatura
        (`invoice_id`) é possível atualizar o objeto `metadata` da fatura.
      operationId: editar-metadados-da-fatura-1
      parameters:
        - name: invoice_id
          in: path
          description: "Código da fatura.<br>Formato: `in_XXXXXXXXXXXXXXXX`."
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - metadata
              properties:
                metadata:
                  type: string
                  description: Objeto chave/valor utilizado para armazenar informações adicionais
                    sobre a fatura.<br>[Saiba mais sobre
                    metadata](https://docs.pagar.me/reference/metadata-1)
            examples:
              Request Example:
                value:
                  metadata:
                    code: "1234"
                    company: Avengers
      responses:
        "200":
          description: "200"
          content:
            application/json:
              examples:
                Result:
                  value: >-
                    {
                        "id": "in_l9JGwX1MsNS3g614",
                        "code": "X8J8HG6HR3",
                        "url": "/invoices/in_l9JGwX1MsNS3g614",
                        "amount": 1490,
                        "status": "paid",
                        "payment_method": "credit_card",
                        "due_at": "2017-08-10T00:00:00Z",
                        "created_at": "2017-08-10T16:02:40Z",
                        "items": [
                            {
                                "name": "Nome - teste",
                                "amount": 1490,
                                "quantity": 1,
                                "description": "Premium"
                            }
                        ],
                        "customer": {
                            "id": "cus_2j4vnqJseriZOM0G",
                            "name": "Tony Stark",
                            "email": "ce7bd9d7-a959-4f64-8070-896c2d968c9a@avengers.com",
                            "delinquent": false,
                            "created_at": "2017-08-10T16:02:28Z",
                            "updated_at": "2017-08-10T16:02:28Z",
                            "phones": {}
                        },
                        "subscription": {
                            "id": "sub_Rg80VjCmxt4N0Oma",
                            "code": "R66DU1I4PR",
                            "start_at": "2017-08-10T00:00:00Z",
                            "interval": "month",
                            "interval_count": 1,
                            "billing_type": "postpaid",
                            "next_billing_at": "2017-09-10T00:00:00Z",
                            "payment_method": "credit_card",
                            "currency": "BRL",
                            "statement_descriptor": "Spotify",
                            "installments": 1,
                            "status": "active",
                            "created_at": "2017-08-10T16:02:30Z",
                            "updated_at": "2017-08-10T16:02:30Z"
                        },
                        "cycle": {
                            "id": "cycle_zObQAYfOqUnMQMkB",
                            "start_at": "2017-08-10T00:00:00Z",
                            "end_at": "2017-09-09T23:59:59Z",
                            "billing_at": "2017-09-10T00:00:00Z"
                        },
                        "charge": {
                            "id": "ch_Wl2YRDrSOFq1Ax4r",
                            "code": "R66DU1I4PR-01",
                            "gateway_id": "798d388b-3e92-4ad1-a0be-893a2391c7fa",
                            "amount": 1490,
                            "paid_amount": 1490,
                            "status": "paid",
                            "currency": "BRL",
                            "payment_method": "credit_card",
                            "due_at": "2017-08-10T00:00:00Z",
                            "paid_at": "2017-08-10T16:02:41Z",
                            "created_at": "2017-08-10T16:02:40Z",
                            "updated_at": "2017-08-10T16:02:40Z",
                            "last_transaction": {
                                "id": "tran_x7lNYXuPLS1np4n1",
                                "transaction_type": "credit_card",
                                "funding_source": "prepaid",
                                "gateway_id": "a4f98f29-c720-4682-985e-f18234160be1",
                                "amount": 1490,
                                "status": "captured",
                                "success": true,
                                "installments": 1,
                                "statement_descriptor": "Spotify",
                                "acquirer_name": "simulator",
                                "acquirer_affiliation_code": "TesteMaroto",
                                "acquirer_tid": "21407",
                                "acquirer_nsu": "743230",
                                "acquirer_auth_code": "214846",
                                "acquirer_message": "Simulator|Transação de simulação autorizada com sucesso",
                                "acquirer_return_code": "0",
                                "operation_type": "auth_and_capture",
                                "card": {
                                    "id": "card_brVjYG5uZSrNARPg",
                                    "first_six_digits": "342793",
                                    "last_four_digits": "8229",
                                    "brand": "Amex",
                                    "holder_name": "Tony Stark",
                                    "exp_month": 1,
                                    "exp_year": 2018,
                                    "status": "active",
                                    "created_at": "2017-08-10T16:02:28Z",
                                    "updated_at": "2017-08-10T16:02:28Z",
                                    "billing_address": {
                                        "line_1": "10880, Malibu Point, Malibu Central",
                                        "zip_code": "90265",
                                        "city": "Malibu",
                                        "state": "CA",
                                        "country": "US"
                                    },
                                    "type": "credit"
                                },
                                "created_at": "2017-08-10T16:02:40Z",
                                "updated_at": "2017-08-10T16:02:40Z",
                                "gateway_response": {
                                    "code": "201"
                                }
                            }
                        },
                        "metadata": {
                            "code": "1234",
                            "company": "Avengers"
                        }
                    }
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: in_l9JGwX1MsNS3g614
                  code:
                    type: string
                    example: X8J8HG6HR3
                  url:
                    type: string
                    example: /invoices/in_l9JGwX1MsNS3g614
                  amount:
                    type: integer
                    example: 1490
                    default: 0
                  status:
                    type: string
                    example: paid
                  payment_method:
                    type: string
                    example: credit_card
                  due_at:
                    type: string
                    example: 2017-08-10T00:00:00Z
                  created_at:
                    type: string
                    example: 2017-08-10T16:02:40Z
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          example: Nome - teste
                        amount:
                          type: integer
                          example: 1490
                          default: 0
                        quantity:
                          type: integer
                          example: 1
                          default: 0
                        description:
                          type: string
                          example: Premium
                  customer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cus_2j4vnqJseriZOM0G
                      name:
                        type: string
                        example: Tony Stark
                      email:
                        type: string
                        example: ce7bd9d7-a959-4f64-8070-896c2d968c9a@avengers.com
                      delinquent:
                        type: boolean
                        example: false
                        default: true
                      created_at:
                        type: string
                        example: 2017-08-10T16:02:28Z
                      updated_at:
                        type: string
                        example: 2017-08-10T16:02:28Z
                      phones:
                        type: object
                        properties: {}
                  subscription:
                    type: object
                    properties:
                      id:
                        type: string
                        example: sub_Rg80VjCmxt4N0Oma
                      code:
                        type: string
                        example: R66DU1I4PR
                      start_at:
                        type: string
                        example: 2017-08-10T00:00:00Z
                      interval:
                        type: string
                        example: month
                      interval_count:
                        type: integer
                        example: 1
                        default: 0
                      billing_type:
                        type: string
                        example: postpaid
                      next_billing_at:
                        type: string
                        example: 2017-09-10T00:00:00Z
                      payment_method:
                        type: string
                        example: credit_card
                      currency:
                        type: string
                        example: BRL
                      statement_descriptor:
                        type: string
                        example: Spotify
                      installments:
                        type: integer
                        example: 1
                        default: 0
                      status:
                        type: string
                        example: active
                      created_at:
                        type: string
                        example: 2017-08-10T16:02:30Z
                      updated_at:
                        type: string
                        example: 2017-08-10T16:02:30Z
                  cycle:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cycle_zObQAYfOqUnMQMkB
                      start_at:
                        type: string
                        example: 2017-08-10T00:00:00Z
                      end_at:
                        type: string
                        example: 2017-09-09T23:59:59Z
                      billing_at:
                        type: string
                        example: 2017-09-10T00:00:00Z
                  charge:
                    type: object
                    properties:
                      id:
                        type: string
                        example: ch_Wl2YRDrSOFq1Ax4r
                      code:
                        type: string
                        example: R66DU1I4PR-01
                      gateway_id:
                        type: string
                        example: 798d388b-3e92-4ad1-a0be-893a2391c7fa
                      amount:
                        type: integer
                        example: 1490
                        default: 0
                      paid_amount:
                        type: integer
                        example: 1490
                        default: 0
                      status:
                        type: string
                        example: paid
                      currency:
                        type: string
                        example: BRL
                      payment_method:
                        type: string
                        example: credit_card
                      due_at:
                        type: string
                        example: 2017-08-10T00:00:00Z
                      paid_at:
                        type: string
                        example: 2017-08-10T16:02:41Z
                      created_at:
                        type: string
                        example: 2017-08-10T16:02:40Z
                      updated_at:
                        type: string
                        example: 2017-08-10T16:02:40Z
                      last_transaction:
                        type: object
                        properties:
                          id:
                            type: string
                            example: tran_x7lNYXuPLS1np4n1
                          transaction_type:
                            type: string
                            example: credit_card
                          funding_source:
                            type: string
                            example: prepaid
                          gateway_id:
                            type: string
                            example: a4f98f29-c720-4682-985e-f18234160be1
                          amount:
                            type: integer
                            example: 1490
                            default: 0
                          status:
                            type: string
                            example: captured
                          success:
                            type: boolean
                            example: true
                            default: true
                          installments:
                            type: integer
                            example: 1
                            default: 0
                          statement_descriptor:
                            type: string
                            example: Spotify
                          acquirer_name:
                            type: string
                            example: simulator
                          acquirer_affiliation_code:
                            type: string
                            example: TesteMaroto
                          acquirer_tid:
                            type: string
                            example: "21407"
                          acquirer_nsu:
                            type: string
                            example: "743230"
                          acquirer_auth_code:
                            type: string
                            example: "214846"
                          acquirer_message:
                            type: string
                            example: Simulator|Transação de simulação autorizada com sucesso
                          acquirer_return_code:
                            type: string
                            example: "0"
                          operation_type:
                            type: string
                            example: auth_and_capture
                          card:
                            type: object
                            properties:
                              id:
                                type: string
                                example: card_brVjYG5uZSrNARPg
                              first_six_digits:
                                type: string
                                example: "342793"
                              last_four_digits:
                                type: string
                                example: "8229"
                              brand:
                                type: string
                                example: Amex
                              holder_name:
                                type: string
                                example: Tony Stark
                              exp_month:
                                type: integer
                                example: 1
                                default: 0
                              exp_year:
                                type: integer
                                example: 2018
                                default: 0
                              status:
                                type: string
                                example: active
                              created_at:
                                type: string
                                example: 2017-08-10T16:02:28Z
                              updated_at:
                                type: string
                                example: 2017-08-10T16:02:28Z
                              billing_address:
                                type: object
                                properties:
                                  line_1:
                                    type: string
                                    example: 10880, Malibu Point, Malibu Central
                                  zip_code:
                                    type: string
                                    example: "90265"
                                  city:
                                    type: string
                                    example: Malibu
                                  state:
                                    type: string
                                    example: CA
                                  country:
                                    type: string
                                    example: US
                              type:
                                type: string
                                example: credit
                          created_at:
                            type: string
                            example: 2017-08-10T16:02:40Z
                          updated_at:
                            type: string
                            example: 2017-08-10T16:02:40Z
                          gateway_response:
                            type: object
                            properties:
                              code:
                                type: string
                                example: "201"
                  metadata:
                    type: object
                    properties:
                      code:
                        type: string
                        example: "1234"
                      company:
                        type: string
                        example: Avengers
        "404":
          description: "404"
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                        "message": "Invoice not found."
                    }
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Invoice not found.
      deprecated: false
security:
  - sec0: []
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic
```
