---
eip: 5007
label: ERC-5007
title: Time NFT, ERC-721 Time Extension
status: Final
type: Standards Track
category: ERC
created: 2022-04-13
requires: 165, 721
official: https://eips.ethereum.org/EIPS/eip-5007
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5007.md
canonical: https://eips.huatuo.xyz/eip-5007/
lang: en
tldr: "Adds startTime and endTime to ERC-721 tokens so an NFT's validity window (a ticket, pass or rental slot) is readable onchain and takes effect automatically, with optional split and merge."
tags: [nft, erc721, time, tickets, rental]
---

# ERC-5007: Time NFT, ERC-721 Time Extension

> Add start time and end time to ERC-721 tokens.

**TL;DR:** Adds startTime and endTime to ERC-721 tokens so an NFT's validity window (a ticket, pass or rental slot) is readable onchain and takes effect automatically, with optional split and merge.

## What problem does it solve?

Many NFTs are only meaningful for a period: a season pass, a concert ticket, a week of access to a virtual property. Without time data in the token, someone has to send a transaction to switch the token on or off at the right moment, which is cumbersome and costs gas. Projects that did add time fields each used their own interface, so marketplaces and tools could not support them generically.

ERC-5007 standardises two read functions so any contract or app can tell when a token is valid, with no transactions needed to "activate" or "expire" it.

## How it works

The core interface (ERC-165 ID `0xf140be0d`):

| Function | Returns |
| --- | --- |
| `startTime(tokenId)` | Start of validity as a UNIX timestamp (`uint64`) |
| `endTime(tokenId)` | End of validity as a UNIX timestamp (`uint64`) |

Both must revert for non-existent tokens. Times are `uint64` because it is natively supported across mainstream languages and lasts for hundreds of billions of years.

An **optional composable extension** (ID `0x75cf3842`) treats time slots as divisible:

- `assetId(tokenId)`: the underlying asset; only tokens with the same asset can be merged.
- `split(oldTokenId, id1, owner1, id2, owner2, splitTime)`: cut one time slot into two at `splitTime` (which must lie within the old token's window). Both new tokens keep the same `assetId`.
- `merge(firstId, secondId, newOwner, newId)`: join two adjacent slots, where `first.endTime + 1 == second.startTime`.

This makes it possible to, say, sell the second half of a year-long pass.

## Sample code

A minimal time NFT and a consumer check (OpenZeppelin v5):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";

interface IERC5007 {
    function startTime(uint256 tokenId) external view returns (uint64);
    function endTime(uint256 tokenId) external view returns (uint64);
}

contract SeasonPass is ERC721, IERC5007 {
    struct Window { uint64 start; uint64 end; }
    mapping(uint256 => Window) private _windows;

    constructor() ERC721("Season Pass", "PASS") {}

    function _mintPass(address to, uint256 id, uint64 start, uint64 end) internal {
        require(start < end, "bad window");
        _windows[id] = Window(start, end);
        _safeMint(to, id);
    }

    function startTime(uint256 id) external view returns (uint64) {
        _requireOwned(id);
        return _windows[id].start;
    }

    function endTime(uint256 id) external view returns (uint64) {
        _requireOwned(id);
        return _windows[id].end;
    }

    function isActive(uint256 id) external view returns (bool) {
        Window memory w = _windows[id];
        return block.timestamp >= w.start && block.timestamp <= w.end;
    }

    function supportsInterface(bytes4 iid) public view override returns (bool) {
        return iid == 0xf140be0d || super.supportsInterface(iid);
    }
}
```

## Things to know

- **Status: Final.**
- The token still exists and transfers normally outside its window. Expiry is a signal for apps to honour, not a burn.
- The `merge` adjacency rule (`end + 1 == start`) implies windows are inclusive of both endpoints, as in the `isActive` check above.
- For rentals where an owner lends usage rights for a period, [ERC-4907](/eip-4907/) (ERC-721) and [ERC-5006](/eip-5006/) (ERC-1155) define a separate `user` role with an expiry; ERC-5007 instead puts the time on the token itself.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-5007
