---
updatedAt: 2026-06-10T11:22:21.000Z
agentTools:
  projectIndex: https://developers.opengateway.telefonica.com/llms.txt
---

# Extend a QoD session v1.1

Extend the overall session duration of an active QoS session (with qosStatus = AVAILABLE).
The overall duration of the QoS session, including the additional extended duration, shall not exceed the maximum duration limit fixed for the QoS Profile. If the current duration plus the value of `requestedAdditionalDuration` exceeds the maximum limit, the new overall duration shall be capped to the maximum value allowed.
An example: For a QoS profile limited to a `maxDuration` of 50,000 seconds, a QoD session was originally created with duration 30,000 seconds. Before the session expires, the developer requests to extend the session by another 30,000 seconds:
- Previous duration: 30,000 seconds
- Requested additional duration: 30,000 seconds
- New overall session duration: 50,000 seconds (the maximum allowed)

**NOTES:**
- The access token may be either 2-legged or 3-legged.
- If a 3-legged access token is used, the subject associated with the session must also be associated with the access token.
- The session must must have been created by the same API consumer given in the access token

Check the [Authorization guide](/docs/authorization) on how to get an OAuth2 token, with the following scope:

`dpv:RequestedServiceProvision#qod`

Create an app on our [Sandbox](/docs/sandbox) to get credentials and [retrieve tokens](/reference/authorize) so you can perform API calls to our operators' production environments, or use the following convenience token to test in mock mode:

`mock_sandbox_access_token`


# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Quality on Demand",
    "description": "The Quality-On-Demand (QoD) API provides a programmable interface for developers and other users (API consumers) to request stable latency or throughput managed by networks without the necessity to have an in-depth knowledge of the underlying network complexity (e.g. the 4G/5G system in case of a mobile network)\n",
    "version": "1.1",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "name": "Telefónica Open Gateway DevRel",
      "url": "https://opengateway.telefonica.com/en/developer-hub",
      "email": "devrel@telefonica.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "servers": [
    {
      "url": "{host}",
      "variables": {
        "host": {
          "default": "sandbox.opengateway.telefonica.com/apigateway",
          "description": "API gateway URL"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Quality on Demand",
      "description": "Manage QoS sessions"
    }
  ],
  "paths": {
    "/quality-on-demand/v1/sessions/{sessionId}/extend": {
      "post": {
        "summary": "Extend a QoD session v1.1",
        "tags": [
          "Quality on Demand"
        ],
        "description": "Extend the overall session duration of an active QoS session (with qosStatus = AVAILABLE).\nThe overall duration of the QoS session, including the additional extended duration, shall not exceed the maximum duration limit fixed for the QoS Profile. If the current duration plus the value of `requestedAdditionalDuration` exceeds the maximum limit, the new overall duration shall be capped to the maximum value allowed.\nAn example: For a QoS profile limited to a `maxDuration` of 50,000 seconds, a QoD session was originally created with duration 30,000 seconds. Before the session expires, the developer requests to extend the session by another 30,000 seconds:\n- Previous duration: 30,000 seconds\n- Requested additional duration: 30,000 seconds\n- New overall session duration: 50,000 seconds (the maximum allowed)\n\n**NOTES:**\n- The access token may be either 2-legged or 3-legged.\n- If a 3-legged access token is used, the subject associated with the session must also be associated with the access token.\n- The session must must have been created by the same API consumer given in the access token\n\nCheck the [Authorization guide](/docs/authorization) on how to get an OAuth2 token, with the following scope:\n\n`dpv:RequestedServiceProvision#qod`\n\nCreate an app on our [Sandbox](/docs/sandbox) to get credentials and [retrieve tokens](/reference/authorize) so you can perform API calls to our operators' production environments, or use the following convenience token to test in mock mode:\n\n`mock_sandbox_access_token`\n",
        "security": [
          {
            "three_legged": [
              "qod"
            ]
          }
        ],
        "operationId": "extendQosSessionDuration",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "description": "Session ID that was obtained from the createSession operation",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SessionId"
            }
          }
        ],
        "requestBody": {
          "description": "Parameters to extend the duration of an active session",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtendSessionDuration"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Contains information about active session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionInfo"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input for extendQosSessionDuration operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInfo"
                },
                "examples": {
                  "Generic400": {
                    "summary": "Some parameter combinations or parameter values provided are not schema compliant",
                    "value": {
                      "code": "INVALID_ARGUMENT",
                      "message": "Schema validation failed at  ..."
                    }
                  },
                  "InactiveSession": {
                    "summary": "The target session is inactive",
                    "value": {
                      "code": "INVALID_ARGUMENT",
                      "message": "The target session is inactive"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Generic401"
          },
          "403": {
            "$ref": "#/components/responses/Generic403"
          },
          "404": {
            "$ref": "#/components/responses/SessionNotFound404"
          },
          "409": {
            "$ref": "#/components/responses/SessionStatusConflict409"
          },
          "429": {
            "$ref": "#/components/responses/Generic429"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "three_legged": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://{host}/authorize",
            "tokenUrl": "https://{host}/token",
            "scopes": {
              "check-sim-swap": "checkSimSwap operation",
              "retrieve-sim-swap-date": "retrieveSimSwapDate operation"
            }
          }
        }
      }
    },
    "schemas": {
      "SessionId": {
        "type": "string",
        "format": "uuid",
        "description": "Session ID in UUID format"
      },
      "BaseSessionInfo": {
        "description": "Common attributes of a QoD session",
        "type": "object",
        "properties": {
          "device": {
            "$ref": "#/components/schemas/Device"
          },
          "applicationServer": {
            "$ref": "#/components/schemas/ApplicationServer"
          },
          "devicePorts": {
            "description": "The ports used locally by the device for flows to which the requested QoS profile should apply. If omitted, then the qosProfile will apply to all flows between the device and the specified application server address and ports",
            "allOf": [
              {
                "$ref": "#/components/schemas/PortsSpec"
              }
            ]
          },
          "applicationServerPorts": {
            "description": "A list of single ports or port ranges on the application server",
            "allOf": [
              {
                "$ref": "#/components/schemas/PortsSpec"
              }
            ]
          },
          "qosProfile": {
            "$ref": "#/components/schemas/QosProfileName"
          },
          "webhook": {
            "type": "object",
            "required": [
              "notificationUrl"
            ],
            "properties": {
              "notificationUrl": {
                "type": "string",
                "format": "uri",
                "example": "https://application-server.com",
                "description": "Allows asynchronous delivery of session related events"
              },
              "notificationAuthToken": {
                "type": "string",
                "minLength": 20,
                "maxLength": 256,
                "example": "c8974e592c2fa383d4a3960714",
                "description": "Authentication token for callback API"
              }
            }
          }
        },
        "required": [
          "device",
          "applicationServer",
          "qosProfile"
        ]
      },
      "ApplicationServer": {
        "description": "A server hosting backend applications to deliver some business logic to clients.\n\nThe developer can choose to provide the below specified device identifiers:\n\n* `ipv4Address`\n* `ipv6Address`\n",
        "type": "object",
        "properties": {
          "ipv4Address": {
            "$ref": "#/components/schemas/ApplicationServerIpv4Address"
          },
          "ipv6Address": {
            "$ref": "#/components/schemas/ApplicationServerIpv6Address"
          }
        },
        "minProperties": 1
      },
      "ApplicationServerIpv4Address": {
        "type": "string",
        "example": "192.168.0.1/24",
        "description": "IPv4 address may be specified in form <address/mask> as:\n  - address - an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule.\n  - address/mask - an IP number as above with a mask width of the form 1.2.3.4/24.\n    In this case, all IP numbers from 1.2.3.0 to 1.2.3.255 will match. The bit width MUST be valid for the IP version.\n"
      },
      "ApplicationServerIpv6Address": {
        "type": "string",
        "example": "2001:db8:85a3:8d3:1319:8a2e:370:7344",
        "description": "IPv6 address may be specified in form <address/mask> as:\n  - address - The /128 subnet is optional for single addresses:\n    - 2001:db8:85a3:8d3:1319:8a2e:370:7344\n    - 2001:db8:85a3:8d3:1319:8a2e:370:7344/128\n  - address/mask - an IP v6 number with a mask:\n    - 2001:db8:85a3:8d3::0/64\n    - 2001:db8:85a3:8d3::/64  \n"
      },
      "SessionInfo": {
        "description": "Session related information returned in responses.\nNote that the device object is defined as optional and will only to be returned if provided in createSession. If more than one type of device identifier was provided, only one identifier will be returned (at implementation choice and with the original value provided in createSession).\nPlease note that IP addresses of devices can change and get reused, so the original values may no longer identify the same device. They identified the device at the time of session creation.\n",
        "allOf": [
          {
            "type": "object",
            "properties": {
              "device": {
                "description": "Disambiguates the device to which the session applies when multiple device identifiers were provided",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/DeviceResponse"
                  },
                  {
                    "example": {
                      "phoneNumber": "+123456789"
                    }
                  }
                ]
              }
            }
          },
          {
            "$ref": "#/components/schemas/BaseSessionInfo"
          },
          {
            "type": "object",
            "properties": {
              "sessionId": {
                "$ref": "#/components/schemas/SessionId"
              },
              "duration": {
                "description": "Session duration in seconds. Implementations can grant the requested session duration or set a different duration, based on network policies or conditions.\n- When `qosStatus` is \"REQUESTED\", the value is the duration to be scheduled, granted by the implementation.\n- When `qosStatus` is AVAILABLE\", the value is the overall duration since `startedAt. When the session is extended, the value is the new overall duration of the session.\n- When `qosStatus` is \"UNAVAILABLE\", the value is the overall effective duration since `startedAt` until the session was terminated.\n",
                "type": "integer",
                "format": "int32",
                "minimum": 1,
                "example": 3600
              },
              "startedAt": {
                "description": "Date and time when the QoS status became \"AVAILABLE\". Not to be returned when `qosStatus` is \"REQUESTED\". It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone.",
                "type": "string",
                "format": "date-time",
                "example": "2024-06-01T12:00:00Z"
              },
              "expiresAt": {
                "description": "Date and time of the QoS session expiration. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone.\n- When `qosStatus` is \"AVAILABLE\", it is the limit time when the session is scheduled to finnish, if not terminated by other means.\n- When `qosStatus` is \"UNAVAILABLE\", it is the time when the session was terminated.\n- Not to be returned when `qosStatus` is \"REQUESTED\".\nWhen the session is extended, the value is the new expiration time of the session.\n",
                "type": "string",
                "format": "date-time",
                "example": "2024-06-01T13:00:00Z"
              },
              "qosStatus": {
                "$ref": "#/components/schemas/QosStatus"
              },
              "statusInfo": {
                "$ref": "#/components/schemas/StatusInfo"
              }
            },
            "required": [
              "sessionId",
              "duration",
              "qosStatus"
            ]
          }
        ]
      },
      "ExtendSessionDuration": {
        "description": "Attributes required to extend the duration of an active session",
        "type": "object",
        "properties": {
          "requestedAdditionalDuration": {
            "description": "Additional duration in seconds to be added to the current session duration. The overall session duration, including extensions, shall not exceed the maximum duration limit for the QoS Profile.\n",
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "example": 1800
          }
        },
        "required": [
          "requestedAdditionalDuration"
        ]
      },
      "PhoneNumber": {
        "description": "A public identifier addressing a telephone subscription. In mobile networks it corresponds to the MSISDN (Mobile Station International Subscriber Directory Number). In order to be globally unique it has to be formatted in international format, according to E.164 standard, optionally prefixed with '+'.",
        "type": "string",
        "pattern": "^\\+?[0-9]{5,15}$",
        "example": "123456789"
      },
      "QosProfileName": {
        "description": "A unique name for identifying a specific QoS profile.\nThis may follow different formats depending on the service providers implementation.\nSome options addresses:\n  - A UUID style string\n  - Support for predefined profiles QOS_S, QOS_M, QOS_L, and QOS_E\n  - A searchable descriptive name\n",
        "type": "string",
        "example": "QCI_1_voice",
        "minLength": 3,
        "maxLength": 256,
        "format": "string",
        "pattern": "^[a-zA-Z0-9_.-]+$"
      },
      "QosStatus": {
        "description": "The current status of the requested QoS session. The status can be one of the following:\n* `REQUESTED` - QoS has been requested by creating a session\n* `AVAILABLE` - The requested QoS has been provided by the network\n* `UNAVAILABLE` - The requested QoS cannot be provided by the network due to some reason\n",
        "type": "string",
        "enum": [
          "REQUESTED",
          "AVAILABLE",
          "UNAVAILABLE"
        ]
      },
      "StatusInfo": {
        "description": "Reason for the new `qosStatus`. Currently `statusInfo` is only applicable when `qosStatus` is 'UNAVAILABLE'.\n* `DURATION_EXPIRED` - Session terminated due to requested duration expired\n* `NETWORK_TERMINATED` - Network terminated the session before the requested duration expired\n* `DELETE_REQUESTED`- User requested the deletion of the session before the requested duration expired\n",
        "type": "string",
        "enum": [
          "DURATION_EXPIRED",
          "NETWORK_TERMINATED",
          "DELETE_REQUESTED"
        ]
      },
      "Device": {
        "description": "End-user equipment able to connect to a mobile network. Examples of devices include smartphones or IoT sensors/actuators.\n\nThe developer can choose to provide the below specified device identifiers:\n\n* `ipv4Address`\n* `ipv6Address`\n* `phoneNumber`\n* `networkAccessIdentifier`\n\nNOTE: the MNO might support only a subset of these options. The API invoker can provide multiple identifiers to be compatible across different MNOs. In this case the identifiers MUST belong to the same device\n",
        "type": "object",
        "properties": {
          "phoneNumber": {
            "$ref": "#/components/schemas/PhoneNumber"
          },
          "networkAccessIdentifier": {
            "$ref": "#/components/schemas/NetworkAccessIdentifier"
          },
          "ipv4Address": {
            "$ref": "#/components/schemas/DeviceIpv4Addr"
          },
          "ipv6Address": {
            "$ref": "#/components/schemas/DeviceIpv6Address"
          }
        },
        "minProperties": 1
      },
      "DeviceIpv4Addr": {
        "type": "object",
        "description": "The device should be identified by either the public (observed) IP address and port as seen by the application server, or the private (local) and any public (observed) IP addresses in use by the device (this information can be obtained by various means, for example from some DNS servers).\n\nIf the allocated and observed IP addresses are the same (i.e. NAT is not in use) then  the same address should be specified for both publicAddress and privateAddress.\n\nIf NAT64 is in use, the device should be identified by its publicAddress and publicPort, or separately by its allocated IPv6 address (field ipv6Address of the Device object)\n\nIn all cases, publicAddress must be specified, along with at least one of either privateAddress or publicPort, dependent upon which is known. In general, mobile devices cannot be identified by their public IPv4 address alone.\n",
        "properties": {
          "publicAddress": {
            "$ref": "#/components/schemas/SingleIpv4Addr"
          },
          "privateAddress": {
            "$ref": "#/components/schemas/SingleIpv4Addr"
          },
          "publicPort": {
            "$ref": "#/components/schemas/Port"
          }
        },
        "anyOf": [
          {
            "required": [
              "publicAddress",
              "privateAddress"
            ]
          },
          {
            "required": [
              "publicAddress",
              "publicPort"
            ]
          }
        ],
        "example": {
          "publicAddress": "84.125.93.10",
          "publicPort": 59765
        }
      },
      "SingleIpv4Addr": {
        "description": "A single IPv4 address with no subnet mask",
        "type": "string",
        "format": "ipv4",
        "example": "84.125.93.10"
      },
      "Port": {
        "description": "TCP or UDP port number",
        "type": "integer",
        "minimum": 0,
        "maximum": 65535
      },
      "DeviceIpv6Address": {
        "description": "The device should be identified by the observed IPv6 address, or by any single IPv6 address from within the subnet allocated to the device (e.g. adding ::0 to the /64 prefix).\n\nThe session shall apply to all IP flows between the device subnet and the specified application server, unless further restricted by the optional parameters devicePorts or applicationServerPorts.\n",
        "type": "string",
        "format": "ipv6",
        "example": "2001:db8:85a3:8d3:1319:8a2e:370:7344"
      },
      "DeviceResponse": {
        "description": "An identifier for the end-user equipment able to connect to the network that the response refers to. This parameter is only returned when the API consumer includes the `device` parameter in their request (i.e. they are using a two-legged access token), and is relevant when more than one device identifier is specified, as only one of those device identifiers is allowed in the response.\n\nIf the API consumer provides more than one device identifier in their request, the API provider must return a single identifier which is the one they are using to fulfil the request, even if the identifiers do not match the same device. API provider does not perform any logic to validate/correlate that the indicated device identifiers match the same device. No error should be returned if the identifiers are otherwise valid to prevent API consumers correlating different identifiers with a given end user.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/Device"
          },
          {
            "maxProperties": 1
          }
        ]
      },
      "PortsSpec": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "ranges": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "from",
                "to"
              ],
              "properties": {
                "from": {
                  "$ref": "#/components/schemas/Port"
                },
                "to": {
                  "$ref": "#/components/schemas/Port"
                }
              }
            }
          },
          "ports": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/Port"
            }
          }
        },
        "example": {
          "ranges": [
            {
              "from": 5010,
              "to": 5020
            }
          ],
          "ports": [
            5060,
            5070
          ]
        }
      },
      "ErrorInfo": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Code given to this error"
          },
          "message": {
            "type": "string",
            "description": "Detailed error description"
          }
        }
      },
      "NetworkAccessIdentifier": {
        "description": "A public identifier addressing a subscription in a mobile network. In 3GPP terminology, it corresponds to the GPSI formatted with the External Identifier ({Local Identifier}@{Domain Identifier}). Unlike the telephone number, the network access identifier is not subjected to portability ruling in force, and is individually managed by each operator.",
        "type": "string",
        "example": "123456789@domain.com"
      }
    },
    "responses": {
      "Generic401": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorInfo"
            },
            "example": {
              "code": "UNAUTHORIZED",
              "message": "Authorization failed: ..."
            }
          }
        }
      },
      "Generic403": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorInfo"
            },
            "example": {
              "code": "FORBIDDEN",
              "message": "Operation not allowed: ..."
            }
          }
        }
      },
      "SessionNotFound404": {
        "description": "Session not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorInfo"
            },
            "example": {
              "code": "NOT_FOUND",
              "message": "Session Id does not exist"
            }
          }
        }
      },
      "SessionStatusConflict409": {
        "description": "Conflict",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/ErrorInfo"
                },
                {
                  "type": "object",
                  "properties": {
                    "status": {
                      "enum": [
                        409
                      ]
                    },
                    "code": {
                      "enum": [
                        "QUALITY_ON_DEMAND.SESSION_EXTENSION_NOT_ALLOWED"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "SessionExtensionNotAllowed": {
                "description": "Session extension is in conflict with current session status",
                "value": {
                  "status": 409,
                  "code": "QUALITY_ON_DEMAND.SESSION_EXTENSION_NOT_ALLOWED",
                  "message": "Extending the session duration is not allowed in the current state ({qosStatus}). The session must be in the AVAILABLE state."
                }
              }
            }
          }
        }
      },
      "Generic429": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/ErrorInfo"
                },
                {
                  "type": "object",
                  "properties": {
                    "status": {
                      "enum": [
                        429
                      ]
                    },
                    "code": {
                      "enum": [
                        "QUOTA_EXCEEDED",
                        "TOO_MANY_REQUESTS"
                      ]
                    }
                  }
                }
              ]
            },
            "examples": {
              "GENERIC_429_QUOTA_EXCEEDED": {
                "description": "Request is rejected due to exceeding a business quota limit",
                "value": {
                  "status": 429,
                  "code": "QUOTA_EXCEEDED",
                  "message": "Out of resource quota."
                }
              },
              "GENERIC_429_TOO_MANY_REQUESTS": {
                "description": "Access to the API has been temporarily blocked due to rate or spike arrest limits being reached",
                "value": {
                  "status": 429,
                  "code": "TOO_MANY_REQUESTS",
                  "message": "Rate limit reached."
                }
              }
            }
          }
        }
      }
    }
  }
}
```