WordPress Rewrite Rules

First you have to filter query vars and add your query var to the array:

add_filter( 'query_vars', 'wpa56345_query_vars' );

function wpa56345_query_vars( $query_vars ){
    $query_vars[] = 'cat_id';
    return $query_vars;
}

Then your rule which captures any digits after your pagename coupons and passes that as cat_id:

add_action( 'init', 'wpa56345_rewrites' );

function wpa56345_rewrites(){
    add_rewrite_rule(
        'coupons/(\d+)/?$',
        'index.php?pagename=coupons&cat_id=$matches[1]',
        'top'
    );
}

The above both go in your theme’s functions.php. Make sure to visit permalinks settings page after adding rewrite rules to flush rules, or they will not take effect. If you put everything into a plugin, you can set it up to flush rules when they are first added.

anyway, in your template, you can then access the value of cat_id with:

echo get_query_var( 'cat_id' );

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.