# createCube method

Information note**STABLE.**   
  
This API is reliable and breaking changes are unlikely.

qlik.app.createCube(qHyperCubeDef, callback)

Defines a hypercube and registers a callback to receive the data.

## Version history

Version history

| Version state | Details |
| --- | --- |
| Introduced | 1.0 |

## Parameters

### qHyperCubeDef

Type: Object

Hypercube definition.

### callback

Type: Function

Optional.

Callback method. Registers a callback that is executed every time data is returned.

Parameter will contain a qHyperCube.

## Returns

A promise of an object model.

Tip noteFor more information regarding a promise, see [The Promise API](https://code.angularjs.org/1.5.8/docs/api/ng/service/$q#the-promise-api).

## Example

```
app.createCube({
	qDimensions : [{
		qDef : {
			qFieldDefs : ["FirstName"]
		}
	}, {
		qDef : {
			qFieldDefs : ["LastName"]
		}
	}],
	qMeasures : [{
		qDef : {
			qDef : "1"
		}
	}],
	qInitialDataFetch : [{
		qTop : 0,
		qLeft : 0,
		qHeight : 20,
		qWidth : 3
	}]
}, function(reply) {
	var str = "";
	$.each(reply.qHyperCube.qDataPages[0].qMatrix, function(key, value) {
		str += '<li>' + value[0].qText + ':' + value[1].qText + '</li>';
	});
	$('#list').html(str);
	;
});
```

## Learn more

* [HyperCubeDef](https://help.qlik.com/en-US/sense-developer/November2025/Subsystems/EngineJSONAPI/Content/models-hypercubedef.htm)