---
schema_version: "1"
id: bc72f1a4e5eb830d5472e6fe899c0fa046dcc3bf97306563f99081c05a27984a
title: getCookies()
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_System_PageReference_getCookies.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_System_PageReference_getCookies.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0be6598a9d4e1c227f773113499ee66294f64f24812d31df4b60506c16e5a91d
description: Returns a map of cookie names and cookie objects, where the key is a String of the cookie name and the the value contains the cookie object with that name.
---
# getCookies()

Returns a map of cookie names and cookie objects, where the key is a String of the cookie name and the the value contains the cookie object with that name.

## Signature

public Map<String, System.Cookie> getCookies()

## Return Value

Type: [Map](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_map.htm#apex_methods_system_map "Contains methods for the Map collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type."), [System.Cookie](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_sites_cookie.htm#apex_classes_sites_cookie "The Cookie class lets you access cookies for your Salesforce site using Apex.")\>

## Usage

Used in conjunction with the Cookie class. Only returns cookies with the “apex\_\_” prefix set by the setCookies method.