[All schemas](/reference/schemas/) · [API reference](/reference/) · [Data mapping guide](/guides/data-model/)

## Fields

| Field | Required | Type / allowed values |
| --- | --- | --- |
| `invoiceId` | Yes | string |
| `creditNoteResolutionId` | Yes | string |
| `locationId` | No | string |
| `discrepancyResponseCode` | Yes | integer |
| `discrepancyResponseDescription` | Yes | string |
| `selectedItems` | No | array |
| `creditNotePayload` | Yes | [CreditNotePayload](/reference/schemas/credit-note-payload/) |

## JSON definition

The JSON retains the source contract descriptions. Do not translate property names or enum values.

```json
{
  "type": "object",
  "properties": {
    "invoiceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9._:-]+$",
      "description": "Identificador opaco."
    },
    "creditNoteResolutionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9._:-]+$",
      "description": "Identificador opaco."
    },
    "locationId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9._:-]+$",
      "description": "Identificador opaco."
    },
    "discrepancyResponseCode": {
      "type": "integer",
      "minimum": 1,
      "maximum": 6,
      "description": "Código DIAN de concepto. 2 = anulación total."
    },
    "discrepancyResponseDescription": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "selectedItems": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/CreditNoteSelection"
      },
      "maxItems": 5000
    },
    "creditNotePayload": {
      "$ref": "#/components/schemas/CreditNotePayload"
    }
  },
  "required": [
    "invoiceId",
    "creditNoteResolutionId",
    "discrepancyResponseCode",
    "discrepancyResponseDescription",
    "creditNotePayload"
  ],
  "additionalProperties": false
}
```
