---
updatedAt: 2026-09-09T03:53:00.000Z
agentTools:
  projectIndex: https://docs.vouchery.io/llms.txt
---

# Get voucher by code

Get single object by its ID

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "contact": {
      "email": "hello@vouchery.io"
    },
    "description": "Vouchery API",
    "license": {
      "name": "Commercial",
      "url": "https://www.vouchery.io"
    },
    "title": "Vouchery",
    "version": "dev-vouchery-go"
  },
  "paths": {
    "/api/v2.1/vouchers/{code}": {
      "get": {
        "description": "Get single object by its ID",
        "operationId": "getApiV21VouchersCode",
        "parameters": [
          {
            "description": "Voucher code",
            "in": "path",
            "name": "code",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Requested object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseVoucher"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_auth": [
              "admin",
              "reader",
              "point_of_sale"
            ]
          }
        ],
        "summary": "Get voucher by code",
        "tags": [
          "Vouchers"
        ]
      }
    }
  },
  "tags": [
    {
      "description": "",
      "externalDocs": {
        "description": "",
        "url": "https://docs.vouchery.io"
      },
      "name": "Vouchers"
    }
  ],
  "servers": [
    {
      "url": "https://admin.sandbox.vouchery.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "app_auth": {
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    },
    "schemas": {
      "responseAuthor": {
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "email"
        ],
        "type": "object"
      },
      "responseCampaign": {
        "properties": {
          "budget_code": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "channel": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "created_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "$ref": "#/components/schemas/responseAuthor"
          },
          "currency": {
            "type": "string"
          },
          "currency_symbol": {
            "type": "string"
          },
          "customer_information": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "description": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "end_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "gift_card_value": {
            "description": "Float64",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "is_automated": {
            "type": "boolean"
          },
          "loyalty_points_cost": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "max_discount": {
            "description": "Float64",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "max_redemptions": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int32",
            "type": "integer"
          },
          "max_redemptions_unit": {
            "format": "int32",
            "type": "integer"
          },
          "max_total_budget": {
            "description": "Float64",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "max_total_budget_unit": {
            "format": "int32",
            "type": "integer"
          },
          "medium": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "minimum_value": {
            "description": "Float64",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "purpose": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "redemptions_count": {
            "format": "int32",
            "type": "integer"
          },
          "rewards": {
            "items": {
              "$ref": "#/components/schemas/responseReward"
            },
            "type": "array"
          },
          "rules": {
            "items": {
              "$ref": "#/components/schemas/responseRule"
            },
            "type": "array"
          },
          "start_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "team": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "template": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "updated_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "updated_by": {
            "$ref": "#/components/schemas/responseAuthor"
          },
          "voucher_code_type": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "voucher_lifetime": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "voucher_max_redemptions": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "voucher_max_redemptions_amount": {
            "description": "Float64",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "voucher_prefix": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "voucher_random_part_length": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int32",
            "type": "integer"
          },
          "voucher_type": {
            "description": "Nullable. String or null.",
            "type": "string"
          }
        },
        "required": [
          "rewards",
          "max_redemptions_unit",
          "max_total_budget_unit",
          "max_discount",
          "max_total_budget",
          "id",
          "updated_at",
          "voucher_max_redemptions_amount",
          "redemptions_count",
          "template",
          "name",
          "rules",
          "is_automated",
          "currency_symbol",
          "minimum_value",
          "status",
          "gift_card_value",
          "currency",
          "type",
          "created_at"
        ],
        "type": "object"
      },
      "responseCustomer": {
        "properties": {
          "anonymised_email": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "birthdate": {
            "$ref": "#/components/schemas/responseCustomerBirthdate"
          },
          "created_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "identifier": {
            "type": "string"
          },
          "loyalty_points": {
            "format": "int32",
            "type": "integer"
          },
          "metadata": {
            "example": "{\"key1\": null, \"key2\": null}",
            "type": "object"
          },
          "name": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "referral_code": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "referred_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "referred_by_id": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "referred_customers": {
            "items": {
              "$ref": "#/components/schemas/responseReferredCustomer"
            },
            "type": "array"
          },
          "type": {
            "type": "string"
          },
          "updated_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "id",
          "referred_customers",
          "identifier",
          "updated_at",
          "type",
          "loyalty_points",
          "metadata"
        ],
        "type": "object"
      },
      "responseCustomerBirthdate": {
        "properties": {
          "day": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "month": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "year": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "responseError_Example_Forbidden": {
        "properties": {
          "code": {
            "example": "forbidden",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "You are not permitted to access this resource",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "message",
          "type",
          "code",
          "error"
        ],
        "type": "object"
      },
      "responseError_Example_Unauthorized": {
        "properties": {
          "code": {
            "example": "not_authorized",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "Not authorized",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "code",
          "error",
          "message",
          "type"
        ],
        "type": "object"
      },
      "responseReferredCustomer": {
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "identifier": {
            "type": "string"
          },
          "name": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "referred_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "identifier",
          "referred_at"
        ],
        "type": "object"
      },
      "responseReward": {
        "properties": {
          "created_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "data": {
            "description": "Reward configuration in JSON",
            "example": "{\"discount_type\": \"percentage\",\"discount_value\": 12}",
            "items": {
              "format": "int32",
              "type": "integer"
            },
            "type": "object"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "reward_type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "description",
          "data",
          "created_at",
          "updated_at",
          "id",
          "reward_type",
          "title"
        ],
        "type": "object"
      },
      "responseRule": {
        "properties": {
          "created_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "data": {
            "description": "Rule configuration in JSON",
            "example": "{\"tags\":[\"attr1\"],\"category\":\"test \",\"matching_type\":\"any_of\"}",
            "items": {
              "format": "int32",
              "type": "integer"
            },
            "type": "object"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "rule_type": {
            "example": "CustomerCategory",
            "type": "string"
          },
          "updated_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "rule_type",
          "data",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "responseVoucher": {
        "properties": {
          "activates_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "allocated_to_customer_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "campaign": {
            "$ref": "#/components/schemas/responseCampaign"
          },
          "campaign_id": {
            "format": "int64",
            "type": "integer"
          },
          "code": {
            "type": "string"
          },
          "created_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/responseCustomer"
          },
          "customer_id": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "distributed_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "expires_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "int32",
            "type": "integer"
          },
          "last_activation_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "last_deactivation_at": {
            "description": "Nullable. ",
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "qr_code_url": {
            "description": "Nullable. String or null.",
            "type": "string"
          },
          "redemptions_confirmed_count": {
            "format": "int32",
            "type": "integer"
          },
          "redemptions_left": {
            "description": "Nullable. Integer or null",
            "example": "123",
            "format": "int64",
            "type": "integer"
          },
          "redemptions_unconfirmed_count": {
            "format": "int32",
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "updated_at": {
            "example": "2021-03-30T20:13:35.339398+01:00",
            "format": "date-time",
            "type": "string"
          },
          "value": {
            "description": "Nullable. Float64 or null",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "value_left": {
            "description": "Nullable. Float64 or null",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "value_reserved": {
            "description": "Nullable. Float64 or null",
            "example": "123.01",
            "format": "double",
            "type": "number"
          },
          "voucher_type": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "updated_at",
          "id",
          "redemptions_confirmed_count",
          "code",
          "created_at",
          "status",
          "campaign_id",
          "redemptions_unconfirmed_count",
          "voucher_type",
          "active"
        ],
        "type": "object"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```