<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSession/configuration",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSession(py)configuration"
  },
  "title" : "configuration"
}
-->

# configuration

A copy of the configuration object for this session.

```
@NSCopying var configuration: URLSessionConfiguration { get }
```

## Discussion

Beginning in iOS 9 and OS X 10.11, [`URLSession`](/documentation/Foundation/URLSession) objects store a copy of the [`URLSessionConfiguration`](/documentation/Foundation/URLSessionConfiguration) object passed to their initializers, such that a session’s configuration is immutable after initialization. Any further changes to mutable properties on the configuration object passed to a session’s initializer or the value returned from a session’s configuration property do not affect the behavior of that session. However, you can create a new session with the modified configuration object.

> Note:
> On previous versions of iOS and macOS, a bug in the implementation causes ``doc://com.apple.foundation/documentation/Foundation/URLSession`` objects to store a *reference* to configuration objects passed to their initializers rather than a copy. This allows the behavior of a session to be further configured after initialization by modifying the configuration object passed to a session’s initializer or the value returned from a session’s ``doc://com.apple.foundation/documentation/Foundation/URLSession/configuration`` property. You can ensure consistent behavior across different platform versions by explicitly calling <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/copy()> on configuration objects passed to a ``doc://com.apple.foundation/documentation/Foundation/URLSession`` initializer or returned from the ``doc://com.apple.foundation/documentation/Foundation/URLSession/configuration`` property.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)