# Retrieve a credit memo

`GET /credit-memos/{id}`

> This is a subset of the full specification, limited to the `GET /credit-memos/{id}` operation.
>
> You can find the full specification here: /_bundle/docs/dev-docs/api/index.yaml

```yaml
openapi: 3.1.1
info:
  version: latest
  title: Core APIs
  contact:
    name: Rebilly API Support
    url: https://www.rebilly.com/contact/
    email: integrations@rebilly.com
  license:
    name: Rebilly
    url: https://www.rebilly.com/api-license/
  termsOfService: https://www.rebilly.com/terms-of-use/
  x-logo:
    url: https://rebilly-core.redoc.ly/rb_apiLogo.svg
    backgroundColor: '#0044d4'
  description: This is a subset of the full specification, limited to the `GET /credit-memos/{id}` operation.
  x-metadata:
    description: The most common APIs used to automate common workflows.
    redocly_category: API Reference
servers:
  - url: https://api-sandbox.rebilly.com/organizations/{organizationId}
    description: Sandbox server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  - url: https://api.rebilly.com/organizations/{organizationId}
    description: Live server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
security:
  - SecretApiKey: []
  - JWT: []
tags:
  - name: Credit memos
    description: |-
      Use credit memos to provide a customer with store credit.
      A common use case for using a credit memo is to provide a customer with store credit,
      rather than a refund, if the customer pays more than they owe or returns a product.
      For information on the credit memo resource, see [Resources](https://www.rebilly.com/docs/dev-docs/concepts/#resources).
x-tagGroups:
  - name: Orders & Invoices
    tags:
      - Credit memos
paths:
  /credit-memos/{id}:
    parameters:
      - $ref: '#/components/parameters/resourceId'
    get:
      x-products:
        - Core
      tags:
        - Credit memos
      summary: Retrieve a credit memo
      parameters:
        - $ref: '#/components/parameters/mediaTypeJsonPdf'
      operationId: GetCreditMemo
      x-sdk-operation-name: get
      security:
        - SecretApiKey: []
        - JWT: []
        - ApplicationJWT: []
      description: Retrieves a credit memo with a specified ID.
      responses:
        '200':
          description: Credit memo retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditMemo'
            application/pdf:
              schema:
                type: string
                format: binary
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  securitySchemes:
    JWT:
      description: |-
        JWT is a short lifetime token that can be assigned a specific expiration time.

        Usage format: `Bearer <JWT>`.
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApplicationJWT:
      description: |-
        Applications in the Rebilly App Store can create a JSON Web Token (JWT) by fetching an user's instance.
        For more information, see Retrieve an application instance.

        Usage format: `Bearer <JWT>`.
      type: http
      scheme: bearer
      bearerFormat: JWT
    SecretApiKey:
      description: |-
        Never share your secret keys.
        Keep them guarded and secure.

        Use your secret API key only to make requests from the server side.
        To authenticate, provide your secret key in the request header.
      name: REB-APIKEY
      type: apiKey
      in: header
  parameters:
    resourceId:
      name: id
      in: path
      description: ID of the resource.
      required: true
      schema:
        type: string
        maxLength: 50
        pattern: ^[@~\-\.\w]+$
    mediaTypeJsonPdf:
      name: Accept
      in: header
      description: Type of response media.
      schema:
        type: string
        enum:
          - application/json
          - application/pdf
        default: application/json
  schemas:
    CreatedTime:
      type: string
      description: |-
        Date and time when the resource is created.
        This value is set automatically when the resource is created.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Creation Time
    UpdatedTime:
      type: string
      description: |-
        Date and time when the resource is updated.
        This value is set automatically when the resource is updated.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Last Update Time
    BaseProblem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    Unauthorized:
      allOf:
        - title: Unauthorized
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 401
              maximum: 401
        - $ref: '#/components/schemas/BaseProblem'
    OrganizationId:
      type: string
      description: |-
        Unique organization identifier.
        An organization is an entity that represents a company.
        For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
      maxLength: 50
      example: org_0YVDM8RC7GDADADSBSMW124JA8
    Forbidden:
      allOf:
        - title: Forbidden
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 403
              maximum: 403
            error:
              type: string
              description: |-
                Message that describes why the request is forbidden.
                Most responses use a descriptive message, such as `Not allowed to change security settings`.
                If the organization requires multi-factor authentication (MFA) and MFA verification has not been completed for the session, this value is `mfa_required`.
                If MFA verification has not been completed for the session and the operation requires a confirmed session, this value is `mfa_required_for_caller`.
                This includes turning on `requireMfa` and resetting MFA for a user.
                If the organization restricts access to a list of IP addresses and the request comes from an IP address that is not in the list, this value is `ip_not_allowed`.
            organizationId:
              description: |-
                ID of the organization that requires MFA or does not allow the IP address of the request.
                This property is present only if `error` is `mfa_required` or `ip_not_allowed`.
                The organization is the organization of the request or another organization that the request acts on.
              $ref: '#/components/schemas/OrganizationId'
        - $ref: '#/components/schemas/BaseProblem'
    NotFound:
      allOf:
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 404
              maximum: 404
        - $ref: '#/components/schemas/BaseProblem'
    CustomerId:
      type: string
      description: ID of the customer resource.
      maxLength: 50
      example: cus_0YV7DDSDD1C8DA64KHH2W33CPF
      x-basic: true
    CurrencyCode:
      type: string
      description: Currency code in ISO 4217 format.
      minLength: 3
      maxLength: 3
      example: USD
      x-label: Currency
    ServerTimestamp:
      type: string
      description: Read-only timestamp in ISO 8601 date-time format.
      format: date-time
      readOnly: true
    TransactionId:
      type: string
      description: ID of the transaction.
      maxLength: 50
      example: txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0
    CreditMemoInvoiceAllocation:
      type: object
      properties:
        invoiceId:
          type: string
          description: ID of invoice to which the credit memo is allocated.
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        amount:
          description: |-
            Amount of credit that is allocated from the credit memo to the invoice.
            When a credit memo is updated, the specified `amount` replaces the existing allocation to the invoice.
            It is not added to the existing allocation.
            If the credit memo is already allocated to the invoice,
            the unused amount of the credit memo and the amount due on the invoice both include the existing allocation.
            If the `amount` value is not supplied or exceeds the unused amount of the credit memo or the invoice due amount, the lesser of the following two values is used:
            - The unused amount of the credit memo.
            - The invoice due amount.
          type: number
          format: double
        currency:
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        createdTime:
          description: Date and time at which a credit memo is allocated.
          $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
    CreditMemoTaxItem:
      type: object
      required:
        - amount
        - description
      properties:
        amount:
          description: Amount of the tax.
          type: number
          format: double
        description:
          type: string
          description: Description of the tax.
        rate:
          description: Overall sales tax rate which includes state, county, city and district tax.
          type:
            - number
            - 'null'
          format: double
        stateAmount:
          description: Amount of sales tax to collect for the state.
          type:
            - number
            - 'null'
          format: double
          example: 0.94
        countyAmount:
          description: Amount of sales tax to collect for the county.
          type:
            - number
            - 'null'
          format: double
          example: 0.04
        cityAmount:
          description: Amount of sales tax to collect for the city.
          type:
            - number
            - 'null'
          format: double
          example: 0
        specialDistrictAmount:
          description: Amount of sales tax to collect for the special district.
          type:
            - number
            - 'null'
          format: double
          example: 0.38
        stateRate:
          description: State sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
        countyRate:
          description: County sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
        cityRate:
          description: City sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
        specialDistrictRate:
          description: Special district sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
        jurisdictions:
          description: Jurisdiction names for the invoice.
          type:
            - object
            - 'null'
          properties:
            country:
              description: Two-letter ISO country code for the provided location.
              type:
                - string
                - 'null'
              example: US
            state:
              description: Postal abbreviated state name for the provided location.
              type:
                - string
                - 'null'
              example: CA
            county:
              description: County name for the provided location.
              type:
                - string
                - 'null'
              example: LOS ANGELES
            city:
              description: City name for the provided location.
              type:
                - string
                - 'null'
              example: LOS ANGELES
    CreditMemo:
      type: object
      description: Credit memo object.
      required:
        - customerId
        - currency
      properties:
        id:
          type: string
          description: ID of the credit memo.
          readOnly: true
          maxLength: 50
          example: crmm_0YVCNN22TWC3G8H82QNPNVZCHG
        number:
          description: Auto-incrementing number based on the sequence of credit memos for any particular customer.
          readOnly: true
          type: integer
        allocations:
          type: object
          description: Allocations reduce the unused amount of a credit memo.
          properties:
            transactions:
              type: array
              description: |-
                List of transactions (typically refunds, credits, and chargebacks) that are allocated to reduce the unused amount of a credit memo.

                  - To delete transaction allocations, send an empty transaction allocation array in the request.
                  - To modify transaction allocations, send a modified transaction allocation array in the request.
                  - If you do not want to modify or delete transaction allocations, do not send a transaction allocation array in the request.
              items:
                type: object
                properties:
                  transactionId:
                    description: ID of the transaction to which the credit memo is allocated.
                    $ref: '#/components/schemas/TransactionId'
                  amount:
                    description: |-
                      Amount of credit that is allocated from the credit memo to the transaction.
                      If the `amount` value is not supplied or exceeds the unused amount of the credit memo or the transaction amount, the lesser of the following two values is used:
                      - The unused amount of the credit memo.
                      - The transaction amount.
                    type: number
                    format: double
                  currency:
                    readOnly: true
                    $ref: '#/components/schemas/CurrencyCode'
                  status:
                    type: string
                    description: Resolution status of the transaction allocation.
                    readOnly: true
                    enum:
                      - pending
                      - approved
                    x-enumDescriptions:
                      pending: |-
                        Result of the refund transaction is unknown, for example, after a timeout.
                        Allocated amount reduces the unused amount of the credit memo,
                        but the credit memo status remains unchanged.
                        If the transaction is approved, the allocation status changes to `approved`.
                        If the transaction is declined, canceled, or abandoned, the allocation is removed.
                      approved: Allocated amount counts toward the `partially-applied` or `applied` status of the credit memo.
                  createdTime:
                    $ref: '#/components/schemas/CreatedTime'
                  updatedTime:
                    $ref: '#/components/schemas/UpdatedTime'
            invoices:
              type: array
              description: |-
                List of invoices that the credit memo is allocated to.

                - To delete invoice allocations, send an empty invoice allocation array in the request.
                  Only `unpaid`, `partially-paid`, and `past-due` invoices can be deleted.
                - To modify invoice allocations, send a modified invoice allocation array in the request.
                  Only `unpaid`, `partially-paid`, and `past-due` invoices can be modified.
                - If you do not want to modify or delete invoice allocations, do not send an invoice allocation array in the request.
              items:
                $ref: '#/components/schemas/CreditMemoInvoiceAllocation'
        items:
          type: array
          description: Items of the credit memo.
          items:
            type: object
            required:
              - unitPrice
              - quantity
            properties:
              id:
                type: string
                description: ID of the credit memo item.
                readOnly: true
                maxLength: 50
                example: crmm_itm_01HXC7PK2C6F367VYCFXDRYMAQ
              invoiceItemId:
                description: ID of the invoice item to which the credit item is referenced.
                type:
                  - string
                  - 'null'
                maxLength: 50
                example: ii_0YVFDEQS2KCFTBN9HXWJFY55GV
              description:
                description: Description of the credit memo item.
                type: string
              unitPrice:
                description: Price of the credit memo item.
                type: number
                format: double
              quantity:
                description: Quantity of the credit memo item.
                type: integer
              price:
                description: Total price of the credit memo item.
                type: number
                format: double
                readOnly: true
              productId:
                type:
                  - string
                  - 'null'
                description: ID of the related product.
                maxLength: 50
                example: prod_0YV7DES3WPC5J8JD8QTVNZBZNZ
              planId:
                description: ID of the related plan.
                type:
                  - string
                  - 'null'
                maxLength: 50
                example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
              tax:
                description: Credit memo item tax.
                oneOf:
                  - $ref: '#/components/schemas/CreditMemoTaxItem'
                  - type: 'null'
        status:
          type: string
          description: Status of the credit memo.
          readOnly: true
          enum:
            - draft
            - quotation
            - issued
            - applied
            - partially-applied
            - voided
          x-enumDescriptions:
            draft: |-
              Credit memo is in process of being created.
              The full amount of the credit memo is unused, and the customer has not seen it yet.
            quotation: |-
              Credit memo is associated with an issued quote.
              When the quote is accepted, the status changes to `issued`, `partially-applied`, or `applied`, based on how much of the credit memo is allocated.
            issued: Credit memo is available with a full amount to be applied.
            applied: |-
              The full amount of the credit memo has been applied.
              No more credit can be created from it.
            partially-applied: |-
              A partial amount of the credit memo has been applied.
              A credit can be created from the remaining amount.
            voided: Credit memo has been voided and cannot be used anymore.
        reason:
          description: Reason for the credit memo.
          type: string
          enum:
            - return
            - product-unsatisfactory
            - order-change
            - order-cancellation
            - chargeback
            - write-off
            - waiver
            - customer-credit
            - prepayment
            - other
        description:
          type: string
          x-basic: true
          description: Public description, that is visible to customers, which describes the purpose of the credit memo.
        shippingAmount:
          description: Shipping amount of an invoice to credit.
          type: number
          format: double
          default: 0
          x-type: Money
        taxAmount:
          description: Sum of items tax amount of an invoice to credit.
          readOnly: true
          type: number
          format: double
          default: 0
          x-type: Money
        totalAmount:
          description: Total amount of all credits in the credit memo, including items, shipping, and tax.
          readOnly: true
          type: number
          format: double
          default: 0
          x-type: Money
        unusedAmount:
          description: Unused credit memo amount that has not been allocated.
          readOnly: true
          type: number
          format: double
          default: 0
          x-type: Money
        revision:
          type: integer
          readOnly: true
          description: Number of times the credit memo has been modified.
        customerId:
          description: |-
            ID of the customer.
            An update request cannot change the customer of an existing credit memo.
            To credit another customer, use the [Void a credit memo](https://www.rebilly.com/catalog/all/credit-memos/postcreditmemovoid) operation,
            then the [Create a credit memo](https://www.rebilly.com/catalog/all/credit-memos/postcreditmemo) operation for that customer.
          $ref: '#/components/schemas/CustomerId'
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        invoiceId:
          type:
            - string
            - 'null'
          description: ID of the invoice to which the credit memo is issued.
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        quoteId:
          type:
            - string
            - 'null'
          description: ID of the related quote.
          readOnly: true
          maxLength: 50
          example: qt_0YVF9605RKC62BP14NE2R7V2XT
        transactionId:
          type:
            - string
            - 'null'
          description: |-
            ID of the transaction associated with the credit memo.
            Associating a transaction does not change the unused amount of the credit memo.
            The transaction must be approved and associated with the same customer as the credit memo.
            Approved transactions of any type are accepted, including refunds and voided sales.
            If the transaction result changes later, the association is retained.
            If this field is omitted in an update request, this field retains its current value.
            To remove the transaction from the credit memo, set this field to `null`.
          maxLength: 50
          example: txn_0YVDTQJ8YKC82BP14NE2R7V2XT
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          type: array
          description: Related links.
          readOnly: true
          items:
            type: object
            properties:
              href:
                description: Link URL.
                type: string
              rel:
                description: Type of link.
                type: string
                enum:
                  - self
                  - customer
                  - invoice
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            customer:
              type: object
  responses:
    Unauthorized:
      description: |-
        Unauthorized access.
        Invalid credentials used.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    Forbidden:
      description: |-
        Access forbidden.
        If the organization requires multi-factor authentication (MFA) and the session has not passed MFA, `error` is `mfa_required`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFound'
```
