<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLResponse",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLResponse"
  },
  "title" : "URLResponse"
}
-->

# URLResponse

The metadata associated with the response to a URL load request, independent of protocol and URL scheme.

```
class URLResponse
```

## Overview

The related [`HTTPURLResponse`](/documentation/Foundation/HTTPURLResponse) class is a commonly used subclass of [`URLResponse`](/documentation/Foundation/URLResponse) whose objects represent a response to an HTTP URL load request and store additional protocol-specific information such as the response headers. Whenever you make an HTTP request, the [`URLResponse`](/documentation/Foundation/URLResponse) object you get back is actually an instance of the [`HTTPURLResponse`](/documentation/Foundation/HTTPURLResponse) class.

> Note:
> ``doc://com.apple.foundation/documentation/Foundation/URLResponse`` objects don’t contain the actual bytes representing the content of a URL. Instead, the data is returned either a piece at a time through delegate calls or in its entirety when the request completes, depending on the method and class used to initiate the request.
> 
> Read <doc://com.apple.foundation/documentation/Foundation/fetching-website-data-into-memory> to learn various ways to receive the content data from a URL load.

## Topics

### Creating a response

[`init(url:mimeType:expectedContentLength:textEncodingName:)`](/documentation/Foundation/URLResponse/init(url:mimeType:expectedContentLength:textEncodingName:)-4s2s1)

Creates an initialized [`URLResponse`](/documentation/Foundation/URLResponse) object with the URL, MIME type, length, and text encoding set to given values.

### Getting the response properties

[`expectedContentLength`](/documentation/Foundation/URLResponse/expectedContentLength)

The expected length of the response’s content.

[`NSURLResponseUnknownLength`](/documentation/Foundation/NSURLResponseUnknownLength)

The response length cannot be determined in advance of receiving the data from the server.

[`suggestedFilename`](/documentation/Foundation/URLResponse/suggestedFilename)

A suggested filename for the response data.

[`mimeType`](/documentation/Foundation/URLResponse/mimeType)

The MIME type of the response.

[`textEncodingName`](/documentation/Foundation/URLResponse/textEncodingName)

The name of the text encoding provided by the response’s originating source.

[`url`](/documentation/Foundation/URLResponse/url)

The URL for the response.



---

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)